lib/dentaku/calculator.rb in dentaku-2.0.9 vs lib/dentaku/calculator.rb in dentaku-2.0.10
- old
+ new
@@ -6,13 +6,13 @@
module Dentaku
class Calculator
attr_reader :result, :memory, :tokenizer
- def initialize
+ def initialize(ast_cache={})
clear
@tokenizer = Tokenizer.new
- @ast_cache = {}
+ @ast_cache = ast_cache
@disable_ast_cache = false
end
def add_function(name, type, body)
Dentaku::AST::Function.register(name, type, body)