def rewrite_defn(exp)
weirdo = exp.ivar || exp.attrset
fbody = exp.fbody(true)
weirdo ||= fbody.cfunc if fbody
exp.push(fbody.scope) if fbody unless weirdo
args = exp.scope.block.args(true) unless weirdo if exp.scope
exp.insert 2, args if args
block_arg = exp.scope.block.block_arg(true) rescue nil
if block_arg
block = args.block(true)
args << "&#{block_arg.last}""&#{block_arg.last}"
args << block if block
end
if weirdo then
case
when fbody && fbody.cfunc then
exp.insert 2, s(:args, "*args""*args")
when exp.ivar then
exp.insert 2, s(:args)
when exp.attrset then
exp.insert 2, s(:args, :arg)
else
raise "unknown wierdo: #{wierdo.inpsect}"
end
end
exp
end