Skip to content
Snippets Groups Projects
Commit 26ceed48 authored by Carlos Galindo's avatar Carlos Galindo
Browse files

Always insert 'return this;' at the end of constructors.

parent c19c0a41
No related branches found
No related tags found
1 merge request!58Object flow and trees
......@@ -196,12 +196,13 @@ public class JSysCFG extends ESCFG {
// Insert call to super() if it is implicit.
if (!ASTUtils.constructorHasExplicitConstructorInvocation(n)){
var superCall = new ExplicitConstructorInvocationStmt(null, null, false, null, new NodeList<>());
var returnThis = new ReturnStmt(new ThisExpr());
methodInsertedInstructions.add(superCall);
methodInsertedInstructions.add(returnThis);
n.getBody().addStatement(0, superCall);
n.getBody().addStatement(returnThis);
}
// insert return this;
var returnThis = new ReturnStmt(new ThisExpr());
methodInsertedInstructions.add(returnThis);
n.getBody().addStatement(returnThis);
// Perform the same task as previous graphs.
super.visit(n, arg);
// Convert enter/exit nodes to implicit if appropriate
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment