Class: Riml::Compiler::ReturnNodeVisitor

Inherits:
Visitor
  • Object
show all
Defined in:
lib/riml/compiler.rb

Instance Method Summary collapse

Methods inherited from Visitor

#initialize, #visit

Constructor Details

This class inherits a constructor from Riml::Compiler::Visitor

Instance Method Details

#compile(node) ⇒ Object



245
246
247
248
249
250
251
252
253
# File 'lib/riml/compiler.rb', line 245

def compile(node)
  node.compiled_output = "return"
  node.force_newline = true
  return node.compiled_output if node.expression.nil?
  node.expression.parent_node = node
  node.compiled_output << " "
  node.expression.accept(visitor_for_node(node.expression))
  node.compiled_output
end