Class: CodeTools::AST::Range

Inherits:
Node
  • Object
show all
Defined in:
lib/rubinius/code/ast/literals.rb

Direct Known Subclasses

RangeExclude

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, #or_bytecode, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #value_defined, #visit, #walk

Constructor Details

#initialize(line, start, finish) ⇒ Range

Returns a new instance of Range.



299
300
301
302
303
# File 'lib/rubinius/code/ast/literals.rb', line 299

def initialize(line, start, finish)
  @line = line
  @start = start
  @finish = finish
end

Instance Attribute Details

#finishObject

Returns the value of attribute finish.



297
298
299
# File 'lib/rubinius/code/ast/literals.rb', line 297

def finish
  @finish
end

#startObject

Returns the value of attribute start.



297
298
299
# File 'lib/rubinius/code/ast/literals.rb', line 297

def start
  @start
end

Instance Method Details

#bytecode(g) ⇒ Object



305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/rubinius/code/ast/literals.rb', line 305

def bytecode(g)
  pos(g)

  g.push_cpath_top
  g.find_const :Range
  g.send :allocate, 0, true
  g.dup
  @start.bytecode(g)
  @finish.bytecode(g)
  g.send :initialize, 2, true
  g.pop
end

#defined(g) ⇒ Object



318
319
320
# File 'lib/rubinius/code/ast/literals.rb', line 318

def defined(g)
  g.push_literal "expression"
end

#to_sexpObject



322
323
324
# File 'lib/rubinius/code/ast/literals.rb', line 322

def to_sexp
  [:dot2, @start.to_sexp, @finish.to_sexp]
end