218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
# File 'lib/duby/transform.rb', line 218
def inspect(indent = 0)
s = ' '*indent + self.class.name.split('::').last
if self.respond_to?(:name)
s << " |#{self.name}|"
end
if self.respond_to?(:value)
s << " ==#{self.value.inspect}"
end
if self.respond_to?(:index)
s << " &#{self.index.inspect}"
end
if self.respond_to?(:depth)
s << " >#{self.depth.inspect}"
end
[:receiver_node, :args_node, :var_node, :head_node, :value_node, :iter_node, :body_node, :next_node, :condition, :then_body, :else_body].each do |mm|
if self.respond_to?(mm)
begin
s << "\n#{self.send(mm).inspect(indent+2)}" if self.send(mm)
rescue
s << "\n#{' '*(indent+2)}#{self.send(mm).inspect}" if self.send(mm)
end
end
end
if org::jruby::ast::ListNode === self
(0...self.size).each do |n|
begin
s << "\n#{self.get(n).inspect(indent+2)}" if self.get(n)
rescue
s << "\n#{' '*(indent+2)}#{self.get(n).inspect}" if self.get(n)
end
end
end
s
end
|