Class: EleetScript::SuperNode

Inherits:
Object
  • Object
show all
Defined in:
lib/lang/nodes.rb,
lib/lang/interpreter.rb

Instance Method Summary collapse

Instance Method Details

#eval(context) ⇒ Object



346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/lang/interpreter.rb', line 346

def eval(context)
  if context.lambda?
    str = context['String'].new_with_value(
      'Cannot call super in a lambda',
      context
    )
    context['Errors'].call(:<, [str])
    context['nil']
  else
    args = arguments.map { |arg| arg.eval(context) }
    context.current_self.super_call(context.name, args)
  end
end