Class: Relaton::Un::Wasm::Interpreter
- Inherits:
-
Object
- Object
- Relaton::Un::Wasm::Interpreter
- Defined in:
- lib/relaton/un/wasm/interpreter.rb
Instance Method Summary collapse
-
#initialize(instance) ⇒ Interpreter
constructor
A new instance of Interpreter.
- #invoke(func_idx, args) ⇒ Object
Constructor Details
#initialize(instance) ⇒ Interpreter
Returns a new instance of Interpreter.
52 53 54 |
# File 'lib/relaton/un/wasm/interpreter.rb', line 52 def initialize(instance) @instance = instance end |
Instance Method Details
#invoke(func_idx, args) ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'lib/relaton/un/wasm/interpreter.rb', line 56 def invoke(func_idx, args) func = @instance.funcs[func_idx] if func.imported? return func.proc.call(Caller.new(@instance), *args) end run_function(func, args) end |