Class: AmberVM::Interpreter::TrivialCoreCall
Instance Attribute Summary
Attributes inherited from CoreCall
#arguments, #function
Attributes inherited from Element
#pos
Instance Method Summary
collapse
Methods inherited from CoreCall
#data_type, #pretty_print
Constructor Details
#initialize(function, arguments, pos = nil) ⇒ TrivialCoreCall
Returns a new instance of TrivialCoreCall.
195
196
197
|
# File 'lib/amber/optimisation.rb', line 195
def initialize function, arguments, pos = nil
super
end
|
Instance Method Details
#execute(env) ⇒ Object
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
|
# File 'lib/amber/optimisation.rb', line 199
def execute env
AmberVM::debug "Executing TrivialCoreCall... args: #{@arguments.inspect}" if $DEBUG
args = nil
args = @arguments.map do |a|
a.val
end
begin
f = @function.call(args, env, @pos)
f
rescue Exception => e
pp self
raise e
raise RuntimeError.new("Function failed to execute: #{e}", @pos[0], @pos[1], @pos[2])
end
end
|
#optimize(variables) ⇒ Object
218
219
220
|
# File 'lib/amber/optimisation.rb', line 218
def optimize variables
self
end
|