Class: TPPlus::Nodes::CallNode

Inherits:
BaseNode
  • Object
show all
Defined in:
lib/tp_plus/nodes/call_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(program_name, args, options = {}) ⇒ CallNode

Returns a new instance of CallNode.



5
6
7
8
9
# File 'lib/tp_plus/nodes/call_node.rb', line 5

def initialize(program_name, args, options={})
  @program_name = program_name
  @args = args
  @async = options[:async]
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



4
5
6
# File 'lib/tp_plus/nodes/call_node.rb', line 4

def args
  @args
end

Instance Method Details

#args_string(context) ⇒ Object



19
20
21
22
23
# File 'lib/tp_plus/nodes/call_node.rb', line 19

def args_string(context)
  return "" unless @args.any?

  "(" + @args.map {|a| a.eval(context) }.join(",") + ")"
end

#async?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/tp_plus/nodes/call_node.rb', line 15

def async?
  @async
end

#can_be_inlined?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/tp_plus/nodes/call_node.rb', line 25

def can_be_inlined?
  true
end

#eval(context, options = {}) ⇒ Object



29
30
31
# File 'lib/tp_plus/nodes/call_node.rb', line 29

def eval(context,options={})
  "#{async? ? "RUN" : "CALL"} #{@program_name.upcase}#{args_string(context)}"
end

#requires_mixed_logic?(context) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/tp_plus/nodes/call_node.rb', line 11

def requires_mixed_logic?(context)
  false
end