Class: CodeTools::AST::StringLiteral

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

Direct Known Subclasses

DynamicString, ExecuteString

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, str) ⇒ StringLiteral

Returns a new instance of StringLiteral.



429
430
431
432
# File 'lib/rubinius/code/ast/literals.rb', line 429

def initialize(line, str)
  @line = line
  @string = str
end

Instance Attribute Details

#stringObject

Returns the value of attribute string.



427
428
429
# File 'lib/rubinius/code/ast/literals.rb', line 427

def string
  @string
end

Instance Method Details

#bytecode(g) ⇒ Object



434
435
436
437
438
439
# File 'lib/rubinius/code/ast/literals.rb', line 434

def bytecode(g)
  pos(g)

  g.push_literal @string
  g.string_dup
end

#defined(g) ⇒ Object



441
442
443
# File 'lib/rubinius/code/ast/literals.rb', line 441

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

#to_sexpObject



445
446
447
# File 'lib/rubinius/code/ast/literals.rb', line 445

def to_sexp
  [:str, @string]
end