Class: Nydp::Builtin::Ensuring

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/nydp/builtin/ensuring.rb

Defined Under Namespace

Classes: InvokeProtection

Instance Method Summary collapse

Methods included from Helper

#cons, #list, #literal?, #pair?, #sym, #sym?

Instance Method Details

#invoke(vm, args) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/nydp/builtin/ensuring.rb', line 16

def invoke vm, args
  fn_ensure = args.car
  fn_tricky = args.cdr.car

  protection_instructions = Nydp::Pair.from_list [InvokeProtection.new(fn_ensure), Nydp::PopArg]
  vm.push_instructions protection_instructions, vm.peek_context

  fn_tricky.invoke vm, Nydp.NIL
end