-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
An attempt to parse the AST and write the AST back to disk using ReWriteVisitor produces incorrect syntax for aliases and function declarations. The right-hand side of the alias expression seems to be missing and arguments for function declarations seem to be skipped. Also, a period is showing up after some identifiers.
== sample before ==
class ActionController::Base
alias orig_params params
def params
if orig_params != nil && !orig_params.respond_to?("in")
orig_params.extend(ActionController_Parameters_Mixin)
end
return orig_params
end
alias orig_redirect_to redirect_to
def redirect_to(options={}, response_status={})
if options.kind_of? String
elsif options.kind_of? Hash
else
# give up
end
orig_redirect_to options, response_status
end
end== rewritevisitor result ==
class ActionController::Base
alias
def params
if orig_params.!=(nil) and orig_params.respond_to?("in").!
orig_params.extend(ActionController_Parameters_Mixin)
end
return orig_params
end
alias
def redirect_to ,
if options.kind_of? String
elsif options.kind_of? Hash
end
orig_redirect_to(options, response_status)
end
endNote the "alias" statements, the arguments for defs (ex: "redirect_to") and the extra period after "orig_params" in the "def params" function.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels