Class: Rubex::AST::Statement::Expression
- Defined in:
- lib/rubex/ast/statement/expression.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #analyse_statement(local_scope) ⇒ Object
- #generate_code(code, local_scope) ⇒ Object
-
#initialize(expr, location) ⇒ Expression
constructor
A new instance of Expression.
Methods inherited from Base
Constructor Details
#initialize(expr, location) ⇒ Expression
Returns a new instance of Expression.
5 6 7 8 |
# File 'lib/rubex/ast/statement/expression.rb', line 5 def initialize(expr, location) super(location) @expr = expr end |
Instance Method Details
#analyse_statement(local_scope) ⇒ Object
10 11 12 13 14 |
# File 'lib/rubex/ast/statement/expression.rb', line 10 def analyse_statement(local_scope) @expr.analyse_types local_scope @expr.allocate_temps local_scope @expr.release_temps local_scope end |
#generate_code(code, local_scope) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/rubex/ast/statement/expression.rb', line 16 def generate_code(code, local_scope) super @expr.generate_evaluation_code code, local_scope code << @expr.c_code(local_scope) + ';' code.nl @expr.generate_disposal_code code end |