class Riml::Compiler::CallNodeVisitor
Public Instance Methods
compile(node)
click to toggle source
# File lib/riml/compiler.rb, line 544 def compile(node) set_modifier(node) if node.name && !node.builtin_function? node.compiled_output = if node.name.respond_to?(:variable) node.name.accept(visitor_for_node(node.name)) node.scope_modifier + node.name.compiled_output elsif DictGetDotNode === node.name node.name.accept(visitor_for_node(node.name)) node.name.compiled_output else node.full_name end compile_arguments(node) node.compiled_output end
compile_arguments(node)
click to toggle source
# File lib/riml/compiler.rb, line 560 def compile_arguments(node) builtin_cmd = node.builtin_command? node.compiled_output << if builtin_cmd if node.arguments.any? then ' ' else '' end else '(' end node.arguments.each_with_index do |arg, i| arg.parent_node = node arg_visitor = visitor_for_node(arg) arg.accept(arg_visitor) node.compiled_output << ", " unless last_arg?(node.arguments, i) end node.compiled_output << ")" unless builtin_cmd node_p = node.parent if node_p.force_newline_if_child_call_node? node.force_newline = true end end
Private Instance Methods
last_arg?(args, i)
click to toggle source
# File lib/riml/compiler.rb, line 581 def last_arg?(args, i) args[i+1].nil? end