Class: Nydp::InvokeFunctionInstruction
- Inherits:
-
Object
- Object
- Nydp::InvokeFunctionInstruction
- Defined in:
- lib/nydp/function_invocation.rb
Instance Method Summary collapse
- #execute(vm) ⇒ Object
-
#initialize(arg_count, source_expression) ⇒ InvokeFunctionInstruction
constructor
A new instance of InvokeFunctionInstruction.
- #inspect ⇒ Object
- #source ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(arg_count, source_expression) ⇒ InvokeFunctionInstruction
Returns a new instance of InvokeFunctionInstruction.
6 7 8 9 |
# File 'lib/nydp/function_invocation.rb', line 6 def initialize arg_count, source_expression @source_expression = source_expression @arg_count = arg_count end |
Instance Method Details
#execute(vm) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/nydp/function_invocation.rb', line 11 def execute vm args = vm.pop_args @arg_count args.car.invoke vm, args.cdr rescue Nydp::Error => ne raise ne rescue InvocationFailed => i_f raise i_f rescue Exception => e msg = "failed to execute invocation #{args.inspect}" msg += "\nsource was #{source.inspect}" msg += "\nfunction name was #{source.car.inspect}" i_f = InvocationFailed.new "#{msg}\n#{vm.error}#{e.}" i_f.set_backtrace e.backtrace raise i_f end |
#inspect ⇒ Object
27 |
# File 'lib/nydp/function_invocation.rb', line 27 def inspect ; source.inspect ; end |
#source ⇒ Object
28 |
# File 'lib/nydp/function_invocation.rb', line 28 def source ; @source_expression ; end |
#to_s ⇒ Object
29 |
# File 'lib/nydp/function_invocation.rb', line 29 def to_s ; source.to_s ; end |