Class: TPPlus::Nodes::UseNode

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

Instance Method Summary collapse

Methods inherited from BaseNode

#can_be_inlined?

Constructor Details

#initialize(type, value) ⇒ UseNode

Returns a new instance of UseNode.



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

def initialize(type, value)
  @type = type
  @value = value
end

Instance Method Details

#eval(context) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/tp_plus/nodes/use_node.rb', line 9

def eval(context)
  case @type
  when "use_uframe"
    "UFRAME_NUM=#{@value.eval(context)}"
  when "use_utool"
    "UTOOL_NUM=#{@value.eval(context)}"
  when "use_payload"
    "PAYLOAD[#{@value.eval(context)}]"
  end
end