Class: Nydp::Closure

Inherits:
Object show all
Defined in:
lib/nydp/closure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ifn, context) ⇒ Closure

Returns a new instance of Closure.



5
6
7
# File 'lib/nydp/closure.rb', line 5

def initialize ifn, context
  @ifn, @context = ifn, context
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



3
4
5
# File 'lib/nydp/closure.rb', line 3

def context
  @context
end

#ifnObject

Returns the value of attribute ifn.



3
4
5
# File 'lib/nydp/closure.rb', line 3

def ifn
  @ifn
end

Instance Method Details

#inspectObject



33
# File 'lib/nydp/closure.rb', line 33

def inspect ; to_s ; end

#invoke(vm, arg_values) ⇒ Object



25
26
27
# File 'lib/nydp/closure.rb', line 25

def invoke vm, arg_values
  ifn.invoke vm, context, arg_values
end

#invoke_1(vm) ⇒ Object



9
10
11
# File 'lib/nydp/closure.rb', line 9

def invoke_1 vm
  ifn.invoke_1 vm, context
end

#invoke_2(vm, arg) ⇒ Object



13
14
15
# File 'lib/nydp/closure.rb', line 13

def invoke_2 vm, arg
  ifn.invoke_2 vm, context, arg
end

#invoke_3(vm, arg_0, arg_1) ⇒ Object



17
18
19
# File 'lib/nydp/closure.rb', line 17

def invoke_3 vm, arg_0, arg_1
  ifn.invoke_3 vm, context, arg_0, arg_1
end

#invoke_4(vm, arg_0, arg_1, arg_2) ⇒ Object



21
22
23
# File 'lib/nydp/closure.rb', line 21

def invoke_4 vm, arg_0, arg_1, arg_2
  ifn.invoke_4 vm, context, arg_0, arg_1, arg_2
end

#nydp_typeObject



29
# File 'lib/nydp/closure.rb', line 29

def nydp_type ; "fn" ; end

#to_sObject



30
31
32
# File 'lib/nydp/closure.rb', line 30

def to_s
  "(closure #{context.to_s} : #{ifn.to_s})"
end