summaryrefslogtreecommitdiff
path: root/chapter08/src/main/java/com/seaofnodes
diff options
context:
space:
mode:
Diffstat (limited to 'chapter08/src/main/java/com/seaofnodes')
-rw-r--r--chapter08/src/main/java/com/seaofnodes/simple/Parser.java2
-rw-r--r--chapter08/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java1
2 files changed, 2 insertions, 1 deletions
diff --git a/chapter08/src/main/java/com/seaofnodes/simple/Parser.java b/chapter08/src/main/java/com/seaofnodes/simple/Parser.java
index 5c699a54..d7055f48 100644
--- a/chapter08/src/main/java/com/seaofnodes/simple/Parser.java
+++ b/chapter08/src/main/java/com/seaofnodes/simple/Parser.java
@@ -284,6 +284,7 @@ public class Parser {
// But first clone the scope and set it as current
int ndefs = _scope.nIns();
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
@@ -293,7 +294,6 @@ public class Parser {
// Parse the false side
_scope = fScope; // Restore scope, then parse else block if any
- ctrl(ifF); // Ctrl token is now set to ifFalse projection
if (matchx("else")) {
parseStatement();
fScope = _scope;
diff --git a/chapter08/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java b/chapter08/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java
index 585592d4..3c4dd7dd 100644
--- a/chapter08/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java
+++ b/chapter08/src/main/java/com/seaofnodes/simple/print/SimpleGraphAdapter.java
@@ -34,6 +34,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 StartNode ) return Kind.CTRL;
if( n instanceof LoopNode ) return Kind.LOOP;