From fcc6da8be593ea4cc0cb3848d4509bd626ebbe1e Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Thu, 15 Aug 2024 12:13:46 -0700 Subject: Scope docs (#99) * More scope docs * readme updates --- .../src/main/java/com/seaofnodes/simple/node/ScopeNode.java | 11 ++++++----- .../src/test/java/com/seaofnodes/simple/Chapter03Test.java | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'chapter03/src') diff --git a/chapter03/src/main/java/com/seaofnodes/simple/node/ScopeNode.java b/chapter03/src/main/java/com/seaofnodes/simple/node/ScopeNode.java index e9ff0f44..379ef033 100644 --- a/chapter03/src/main/java/com/seaofnodes/simple/node/ScopeNode.java +++ b/chapter03/src/main/java/com/seaofnodes/simple/node/ScopeNode.java @@ -7,11 +7,12 @@ import java.util.*; /** * The Scope node is purely a parser helper - it tracks names to nodes with a * stack of scopes. + * @see chapter03/README.md */ public class ScopeNode extends Node { /** - * Names for every input edge + * A Stack of symbol tables; a symbol table is a map from names to node indices. */ public final Stack> _scopes; @@ -48,7 +49,7 @@ public class ScopeNode extends Node { * Recover the names for all variable bindings. * The result is an array of names that is aligned with the * inputs to the Node. - * + *

* This is an expensive operation. */ public String[] reverseNames() { @@ -77,21 +78,21 @@ public class ScopeNode extends Node { } /** * Lookup a name in all scopes starting from most deeply nested. - * + *

* @param name Name to be looked up * @see #update(String, Node, int) */ public Node lookup( String name ) { return update(name,null,_scopes.size()-1); } /** * If the name is present in any scope, then redefine else null - * + *

* @param name Name being redefined * @param n The node to bind to the name */ public Node update( String name, Node n ) { return update(name,n,_scopes.size()-1); } /** * Both recursive lookup and update. - * + *

* A shared implementation allows us to create lazy phis both during * lookups and updates; the lazy phi creation is part of chapter 8. * diff --git a/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java b/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java index 950d87fe..bdb1d9ea 100644 --- a/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java +++ b/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java @@ -1,7 +1,6 @@ package com.seaofnodes.simple; import com.seaofnodes.simple.node.*; -import com.seaofnodes.simple.type.TypeInteger; import org.junit.Test; import static org.junit.Assert.*; -- cgit v1.2.3