Commit 26ceed48 authored by Carlos Galindo's avatar Carlos Galindo
Browse files

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

parent c19c0a41
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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