Class: KoiReferenceCompiler::HashAssignment

Inherits:
SyntaxNode
  • Object
show all
Defined in:
lib/koi-reference-compiler/node_extensions/hash_literals/hash_assignment.rb

Instance Attribute Summary

Attributes inherited from SyntaxNode

#elements, #offset, #parent, #text_value

Instance Method Summary collapse

Methods inherited from SyntaxNode

#initialize

Constructor Details

This class inherits a constructor from KoiReferenceCompiler::SyntaxNode

Instance Method Details

#compileObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/koi-reference-compiler/node_extensions/hash_literals/hash_assignment.rb', line 4

def compile
  expression = self.elements[3].compile

  bytecode = []
  bytecode.concat( self.elements[0].compile )
  bytecode.concat( self.elements[1].compile )
  tmp = bytecode.slice!(-2,2)
  bytecode.concat( expression )
  bytecode.concat( tmp )
  return bytecode
end