class Riml::Compiler::GetVariableNodeVisitor

scope_modifier, name

Public Instance Methods

compile(node) click to toggle source
# File lib/riml/compiler.rb, line 340
def compile(node)
  set_modifier(node)

  if node.scope && node.scope.function?
    if splat = node.scope.function.splat
      check_for_splat_match!(node, splat)
    end
  end

  if node.question_existence?
    node.compiled_output = %Q{exists("#{node.full_name}")}
  else
    node.compiled_output = "#{node.full_name}"
  end
end

Private Instance Methods

check_for_splat_match!(node, splat) click to toggle source
# File lib/riml/compiler.rb, line 357
def check_for_splat_match!(node, splat)
  # if `function doIt(*options)`, then:
  # *options OR options in function body becomes `a:000`
  if [ splat, splat[1..-1] ].include?(node.name)
    node.scope_modifier = 'a:'
    node.name = '000'
  end
end