Class: Rubex::AST::Statement::Break

Inherits:
Base
  • Object
show all
Defined in:
lib/rubex/ast/statement/break.rb

Instance Attribute Summary

Attributes inherited from Base

#location

Instance Method Summary collapse

Methods inherited from Base

#==, #initialize, #statement?

Constructor Details

This class inherits a constructor from Rubex::AST::Statement::Base

Instance Method Details

#analyse_statement(local_scope) ⇒ Object



5
6
7
8
# File 'lib/rubex/ast/statement/break.rb', line 5

def analyse_statement(local_scope)
  # TODO: figure whether this is a Ruby break or C break. For now
  #   assuming C break.
end

#generate_code(code, _local_scope) ⇒ Object



10
11
12
13
14
# File 'lib/rubex/ast/statement/break.rb', line 10

def generate_code(code, _local_scope)
  code.write_location @location
  code << 'break;'
  code.nl
end