diff options
Diffstat (limited to 'chapter24/src/main/java/com')
| -rw-r--r-- | chapter24/src/main/java/com/seaofnodes/simple/Parser.java | 3 | ||||
| -rw-r--r-- | chapter24/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/chapter24/src/main/java/com/seaofnodes/simple/Parser.java b/chapter24/src/main/java/com/seaofnodes/simple/Parser.java index c9e53b4b..cd4d5afb 100644 --- a/chapter24/src/main/java/com/seaofnodes/simple/Parser.java +++ b/chapter24/src/main/java/com/seaofnodes/simple/Parser.java @@ -555,6 +555,7 @@ public class Parser { // In if true branch, the ifT proj node becomes the ctrl // But first clone the scope and set it as current ScopeNode fScope = _scope.dup(); // Duplicate current scope + fScope.ctrl(ifF); // The pending arm already starts at False _xScopes.push(fScope); // For graph visualization we need all scopes // Parse the true side @@ -580,7 +581,7 @@ public class Parser { // Parse the false side _scope = fScope; // Restore scope, then parse else block if any - ctrl(ifF.unkeep()); // Ctrl token is now set to ifFalse projection + ifF.unkeep(); // fScope already owns the false control // Up-cast predicate, even if not else clause, because predicate can // remain true if the true clause exits: `if( !ptr ) return 0; return ptr.fld;` _scope.addGuards(ifF,pred,true); diff --git a/chapter24/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java b/chapter24/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java index bf8f4181..374197c0 100644 --- a/chapter24/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java +++ b/chapter24/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java @@ -38,6 +38,7 @@ public class SimpleGraphAdapter extends GraphAdapter<Node> { } private Kind kind(Node n) { + if( n instanceof StopNode ) return Kind.STOP; if( n instanceof ScopeNode ) return Kind.SCOPE; if( n instanceof FunNode ) return Kind.FUN; if( n instanceof StartNode ) return Kind.CTRL; |
