282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
# File 'lib/duby/transform.rb', line 282
def transform(transformer, parent)
Arguments.new(parent, position) do |args_node|
arg_list = args.child_nodes.map do |node|
if !node.respond_to?(:type_node) || node.type_node.respond_to?(:type_reference)
RequiredArgument.new(args_node, node.position, node.name)
else
OptionalArgument.new(args_node, node.position, node.name) {|opt_arg| [transformer.transform(node, opt_arg)]}
end
end if args
opt_list = optional.child_nodes.map do |node|
OptionalArgument.new(args_node, node.position) {|opt_arg| [transformer.transform(node, opt_arg)]}
end if false && optional
rest_arg = RestArgument.new(args_node, rest.position, rest.name) if rest
block_arg = BlockArgument.new(args_node, block.position, block.name) if block
[arg_list, opt_list, rest_arg, block_arg]
end
end
|