Class: SyntaxTree::YARV::Assembler::ObjectVisitor

Inherits:
Compiler::RubyVisitor show all
Defined in:
lib/syntax_tree/yarv/assembler.rb

Instance Method Summary collapse

Methods inherited from Compiler::RubyVisitor

compile, #visit_regexp_literal_flags, #visit_unsupported

Methods inherited from BasicVisitor

valid_visit_methods, #visit, #visit_all, #visit_child_nodes, visit_method, visit_methods

Instance Method Details

#visit_dyna_symbol(node) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/syntax_tree/yarv/assembler.rb', line 7

def visit_dyna_symbol(node)
  if node.parts.empty?
    :""
  else
    raise CompilationError
  end
end

#visit_string_literal(node) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/syntax_tree/yarv/assembler.rb', line 15

def visit_string_literal(node)
  case node.parts.length
  when 0
    ""
  when 1
    raise CompilationError unless node.parts.first.is_a?(TStringContent)
    node.parts.first.value
  else
    raise CompilationError
  end
end