Class: Node::BLOCK

Inherits:
Node
  • Object
show all
Defined in:
lib/decompiler/node/as_expression.rb

Instance Method Summary collapse

Methods inherited from Node

#as_code, #as_expression, #as_paren_expression, define_code, define_expression

Instance Method Details

#as_expression_impl(node) ⇒ Object



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/decompiler/node/as_expression.rb', line 134

def as_expression_impl(node)
  a = node.to_a
  if a.size == 1 then
    return 'nil'
  end
  d = a[0]
  while d.class == Node::DASGN_CURR do
    d = d.value
  end
  a.shift if not d
  expressions = a.map { |n| n.as_expression }
  expressions.reject! { |e| e.nil? }
  if expressions.nitems == 0 then
    return 'nil'
  else
    return expressions.join('; ')
  end
end