Class: Kalc::Ast::FunctionCall

Inherits:
Object
  • Object
show all
Defined in:
lib/kalc/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, variable_list) ⇒ FunctionCall

Returns a new instance of FunctionCall.



241
242
243
244
# File 'lib/kalc/ast.rb', line 241

def initialize(name, variable_list)
  @name = name
  @variable_list = variable_list
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



238
239
240
# File 'lib/kalc/ast.rb', line 238

def name
  @name
end

#variable_listObject (readonly)

Returns the value of attribute variable_list.



239
240
241
# File 'lib/kalc/ast.rb', line 239

def variable_list
  @variable_list
end

Instance Method Details

#eval(context) ⇒ Object



246
247
248
249
# File 'lib/kalc/ast.rb', line 246

def eval(context)
  to_call = context.get_function(@name)
  to_call.call(context, *@variable_list) if to_call
end