Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move declaration to correct place #13696

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -753,9 +753,8 @@ protected void initializeAndValidateCommandObjectParameter(final BlockStatement
final ClassNode controllerNode, final ClassNode commandObjectNode,
final ASTNode actionNode, final String actionName, final String paramName,
final SourceUnit source, final GeneratorContext context) {
final DeclarationExpression declareCoExpression = new DeclarationExpression(
new VariableExpression(paramName, commandObjectNode), Token.newSymbol(Types.EQUALS, 0, 0), new EmptyExpression());
wrapper.addStatement(new ExpressionStatement(declareCoExpression));
final DeclarationExpression declareCoExpression = declX(localVarX(paramName, commandObjectNode), new EmptyExpression());
wrapper.addStatement(stmt(declareCoExpression));

if(commandObjectNode.isInterface() || Modifier.isAbstract(commandObjectNode.getModifiers())) {
final String warningMessage = "The [" + actionName + "] action in [" +
Expand Down Expand Up @@ -846,7 +845,7 @@ protected void initializeCommandObjectParameter(final BlockStatement wrapper,
final ArgumentListExpression initializeCommandObjectArguments = args(classX(commandObjectNode), constX(paramName));
final MethodCallExpression initializeCommandObjectMethodCall = callThisX("initializeCommandObject", initializeCommandObjectArguments);
applyDefaultMethodTarget(initializeCommandObjectMethodCall, commandObjectNode);
final Expression assignCommandObjectToParameter = assignX(varX(paramName, commandObjectNode), initializeCommandObjectMethodCall);
final Expression assignCommandObjectToParameter = assignX(varX(paramName), initializeCommandObjectMethodCall);
wrapper.addStatement(stmt(assignCommandObjectToParameter));
}

Expand Down
Loading