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.



398
399
400
401
# File 'lib/rubinius/code/ast/literals.rb', line 398

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

Instance Attribute Details

#stringObject

Returns the value of attribute string.



396
397
398
# File 'lib/rubinius/code/ast/literals.rb', line 396

def string
  @string
end

Instance Method Details

#bytecode(g) ⇒ Object



403
404
405
406
407
408
# File 'lib/rubinius/code/ast/literals.rb', line 403

def bytecode(g)
  pos(g)

  g.push_literal @string
  g.string_dup
end

#defined(g) ⇒ Object



410
411
412
# File 'lib/rubinius/code/ast/literals.rb', line 410

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

#to_sexpObject



414
415
416
# File 'lib/rubinius/code/ast/literals.rb', line 414

def to_sexp
  [:str, @string]
end