Class: Nydp::InterpretedFunctionWithClosure

Inherits:
InterpretedFunction show all
Defined in:
lib/nydp/interpreted_function.rb

Constant Summary

Constants inherited from InterpretedFunction

Nydp::InterpretedFunction::NIL

Instance Attribute Summary

Attributes inherited from InterpretedFunction

#arg_names, #body, #context_builder

Instance Method Summary collapse

Methods inherited from InterpretedFunction

build, #can_do?, compile_body, #compile_do_expr_to_ruby, #compile_to_ruby, index_parameters, #inspect, #lexical_reach, #nydp_type, #run_body, #to_s

Methods included from Helper

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

Methods included from Converter

#n2r, #r2n, #rubify

Instance Method Details

#execute(vm) ⇒ Object



199
200
201
202
# File 'lib/nydp/interpreted_function.rb', line 199

def execute vm
  Closure.new(self, vm.current_context)
  # vm.push_arg Closure.new(self, vm.current_context)
end

#invoke(vm, ctx, arg_values) ⇒ Object



190
191
192
193
194
195
196
197
# File 'lib/nydp/interpreted_function.rb', line 190

def invoke vm, ctx, arg_values
  cc                 = vm.current_context
  vm.current_context = set_args(ctx, arg_values)
  res                = run_body(vm)
  vm.current_context = cc
  res
  # vm.push_instructions self.body, set_args(ctx, arg_values)
end

#invoke_1(vm, ctx) ⇒ Object



154
155
156
157
158
159
160
161
# File 'lib/nydp/interpreted_function.rb', line 154

def invoke_1 vm, ctx
  cc                 = vm.current_context
  vm.current_context = set_args_0(ctx)
  res                = run_body(vm)
  vm.current_context = cc
  res
  # vm.push_instructions self.body, set_args_0(ctx)
end

#invoke_2(vm, ctx, arg) ⇒ Object



163
164
165
166
167
168
169
170
# File 'lib/nydp/interpreted_function.rb', line 163

def invoke_2 vm, ctx, arg
  cc                 = vm.current_context
  vm.current_context = set_args_1(ctx, arg)
  res                = run_body(vm)
  vm.current_context = cc
  res
  # vm.push_instructions self.body, set_args_1(ctx, arg)
end

#invoke_3(vm, ctx, arg_0, arg_1) ⇒ Object



172
173
174
175
176
177
178
179
# File 'lib/nydp/interpreted_function.rb', line 172

def invoke_3 vm, ctx, arg_0, arg_1
  cc                 = vm.current_context
  vm.current_context = set_args_2(ctx, arg_0, arg_1)
  res                = run_body(vm)
  vm.current_context = cc
  res
  # vm.push_instructions self.body, set_args_2(ctx, arg_0, arg_1)
end

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



181
182
183
184
185
186
187
188
# File 'lib/nydp/interpreted_function.rb', line 181

def invoke_4 vm, ctx, arg_0, arg_1, arg_2
  cc                 = vm.current_context
  vm.current_context = set_args_3(ctx, arg_0, arg_1, arg_2)
  res                = run_body(vm)
  vm.current_context = cc
  res
  # vm.push_instructions self.body, set_args_3(ctx, arg_0, arg_1, arg_2)
end