diff options
Diffstat (limited to 'st/SymTableBottomUp.java')
-rw-r--r-- | st/SymTableBottomUp.java | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/st/SymTableBottomUp.java b/st/SymTableBottomUp.java index b0772fc..72a4575 100644 --- a/st/SymTableBottomUp.java +++ b/st/SymTableBottomUp.java @@ -52,14 +52,12 @@ public class SymTableBottomUp<R> extends GJDepthFirst<R,SymbolTable> { n.f17.accept(this, symt); - String id = n.f1.f0.tokenImage; - ClassInstance instance = new ClassInstance(id); - MinimalLogger.info("Inserting " + id + " => " + instance.getType()); + TokenKey id = new TokenKey(n.f1.f0.tokenImage, 0); + ClassInstance instance = new ClassInstance(id.getName()); symt.put(id, instance); - id = "main"; - MethodInstance main = new MethodInstance(id, TypeEnum.ERROR); - MinimalLogger.info("Inserting " + id + " => " + main.getType()); + id = new TokenKey(n.f6.tokenImage, n.f6.beginLine); + MethodInstance main = new MethodInstance(id.getName(), TypeEnum.ERROR); symt.put(id, main); @@ -83,9 +81,8 @@ public class SymTableBottomUp<R> extends GJDepthFirst<R,SymbolTable> { n.f5.accept(this, symt); - String id = n.f1.f0.tokenImage; - ClassInstance instance = new ClassInstance(id); - MinimalLogger.info("Inserting " + id + " => " + instance.getType()); + TokenKey id = new TokenKey(n.f1.f0.tokenImage, 0); + ClassInstance instance = new ClassInstance(id.getName()); symt.put(id, instance); @@ -113,9 +110,8 @@ public class SymTableBottomUp<R> extends GJDepthFirst<R,SymbolTable> { n.f7.accept(this, symt); - String id = n.f1.f0.tokenImage; - ClassInstance instance = new ClassInstance(id); - MinimalLogger.info("Inserting " + id + " => " + instance.getType()); + TokenKey id = new TokenKey(n.f1.f0.tokenImage, 0); + ClassInstance instance = new ClassInstance(id.getName()); symt.put(id, instance); @@ -132,7 +128,7 @@ public class SymTableBottomUp<R> extends GJDepthFirst<R,SymbolTable> { n.f1.accept(this, symt); n.f2.accept(this, symt); - String id = n.f1.f0.tokenImage; + TokenKey id = new TokenKey(n.f1.f0.tokenImage, n.f1.f0.beginLine); TypeEnum rtrn = TypeEnum.ERROR; switch (n.f0.f0.which) { case 0: @@ -147,8 +143,7 @@ public class SymTableBottomUp<R> extends GJDepthFirst<R,SymbolTable> { MinimalLogger.severe("Unsupported case"); } - TypeInstance instance = new TypeInstance(id, rtrn); - MinimalLogger.info("Inserting " + id + " => " + instance.getType()); + TypeInstance instance = new TypeInstance(id.getName(), rtrn); symt.put(id, instance); @@ -186,7 +181,8 @@ public class SymTableBottomUp<R> extends GJDepthFirst<R,SymbolTable> { n.f12.accept(this, symt); - String id = n.f2.f0.tokenImage; + + TokenKey id = new TokenKey(n.f2.f0.tokenImage, n.f2.f0.beginLine); TypeEnum rtrn = TypeEnum.ERROR; switch (n.f1.f0.which) { case 0: @@ -201,8 +197,7 @@ public class SymTableBottomUp<R> extends GJDepthFirst<R,SymbolTable> { MinimalLogger.severe("Unsupported case"); } - MethodInstance instance = new MethodInstance(id, rtrn); - MinimalLogger.info("Inserting " + id + " => " + instance.getType()); + MethodInstance instance = new MethodInstance(id.getName(), rtrn); symt.put(id, instance); @@ -218,7 +213,7 @@ public class SymTableBottomUp<R> extends GJDepthFirst<R,SymbolTable> { n.f1.accept(this, symt); - String id = n.f1.f0.tokenImage; + TokenKey id = new TokenKey(n.f1.f0.tokenImage, n.f1.f0.beginLine); TypeEnum rtrn = TypeEnum.ERROR; switch (n.f0.f0.which) { case 0: @@ -233,8 +228,7 @@ public class SymTableBottomUp<R> extends GJDepthFirst<R,SymbolTable> { MinimalLogger.severe("Unsupported case"); } - TypeInstance instance = new TypeInstance(id, rtrn); - MinimalLogger.info("Inserting " + id + " => " + instance.getType()); + TypeInstance instance = new TypeInstance(id.getName(), rtrn); symt.put(id, instance); |