Class: KoiReferenceCompiler::FunctionDefinition
- Inherits:
-
SyntaxNode
- Object
- SyntaxNode
- KoiReferenceCompiler::FunctionDefinition
- Defined in:
- lib/koi-reference-compiler/node_extensions/functions/function_definition.rb
Instance Attribute Summary
Attributes inherited from SyntaxNode
#elements, #offset, #parent, #text_value
Instance Method Summary collapse
Methods inherited from SyntaxNode
Constructor Details
This class inherits a constructor from KoiReferenceCompiler::SyntaxNode
Instance Method Details
#compile ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/koi-reference-compiler/node_extensions/functions/function_definition.rb', line 4 def compile function_id = self.offset bytecode = [ PUSH_FUNCTION, function_id ] bytecode.concat( self.elements[0].compile ) bytecode.concat( self.elements[1].compile ) bytecode.concat([ RETURN, END_FUNCTION, 0, END_FUNCTION, function_id ]) end |