@@ -50,8 +50,8 @@ public map[Node, list[Node]] replace(Node X) {
5050
5151 // Deal with all nodes that aren't assigments bug uses a variable in some way
5252 if (isNonAssignmentStatementToRename (X )) {
53- stmtNode ( statement ) = X ;
54- Node renamedStatement = stmtNode (replaceImmediateUse (statement ));
53+ statementBody = returnStmtNodeBody ( X ) ;
54+ Node renamedStatement = stmtNode (replaceImmediateUse (statementBody ));
5555 renameNodeOcurrecies (X , renamedStatement );
5656 X = renamedStatement ;
5757 };
@@ -216,7 +216,7 @@ public bool isSkipableStatement(stmtArgument) {
216216}
217217
218218public Node replacePhiFunctionVersion (map [Node , list [Node ]] blockTree , Node variableNode ) {
219- stmtNode ( assignStatement ) = variableNode ;
219+ assignStatement = returnStmtNodeBody ( variableNode );
220220 assign (assignVariable , assignPhiFunction ) = assignStatement ;
221221 phiFunction (phiFunctionVariable , variableVersionList ) = assignPhiFunction ;
222222 variableName = phiFunctionVariable [0 ];
@@ -430,6 +430,12 @@ public list[Immediate] getExpressionImmediates(Expression expression) {
430430 }
431431}
432432
433+ public Statement returnStmtNodeBody (Node stmtNode ) {
434+ switch (stmtNode ) {
435+ case stmtNode (stmtBody ): return stmtBody ;
436+ }
437+ }
438+
433439public Variable returnLeftHandSideVariable (Node stmtNode ) {
434440 switch (stmtNode ) {
435441 case stmtNode (assign (leftHandSide , _)): return leftHandSide ;
0 commit comments