Class: Rubex::AST::Statement::Base

Inherits:
Object
  • Object
show all
Includes:
Helpers::NodeTypeMethods
Defined in:
lib/rubex/ast/statement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ Base

Returns a new instance of Base.



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

def initialize(location)
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

File name and line number of statement in “file_name:lineno” format.



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

def location
  @location
end

Instance Method Details

#==(other) ⇒ Object



20
21
22
# File 'lib/rubex/ast/statement.rb', line 20

def ==(other)
  self.class == other.class
end

#generate_code(code, _local_scope) ⇒ Object



24
25
26
# File 'lib/rubex/ast/statement.rb', line 24

def generate_code(code, _local_scope)
  code.write_location @location
end

#statement?Boolean

Returns:



16
17
18
# File 'lib/rubex/ast/statement.rb', line 16

def statement?
  true
end