diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-25 23:34:56 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-25 23:34:56 -0600 |
commit | 7e6c63a4d5a4acf9a4f993e6dff6ee7912f26c1e (patch) | |
tree | e8dfb25ebdde640815caa6920bfe894be63fd3ab | |
parent | a4090b25b5433ce007c91cabbd4c247f6a6c81f1 (diff) |
Fix message send to handle class variables
-rw-r--r-- | boil/library/BoilVisitor.java | 4 | ||||
-rw-r--r-- | boil/library/TypeFactory.java | 6 | ||||
-rw-r--r-- | st/MethodInstance.java | 3 | ||||
-rw-r--r-- | st/TokenKey.java | 17 |
4 files changed, 26 insertions, 4 deletions
diff --git a/boil/library/BoilVisitor.java b/boil/library/BoilVisitor.java index f977491..0c0f76a 100644 --- a/boil/library/BoilVisitor.java +++ b/boil/library/BoilVisitor.java @@ -938,6 +938,10 @@ public class BoilVisitor extends GJDepthFirst<String,String> { t = this.symt.getType(rhs); if (t == null) t = this.symt.getTypeAttr(rhs); + rhs = n.f0.accept(this, argu); + this.addVapor(String.format(" %s = %s\n", + this.tf.alias(t.getName()), + rhs)); break; case 4: // we'll do everything here and exit the function diff --git a/boil/library/TypeFactory.java b/boil/library/TypeFactory.java index 47b97b2..ddf54c8 100644 --- a/boil/library/TypeFactory.java +++ b/boil/library/TypeFactory.java @@ -20,9 +20,11 @@ public class TypeFactory { */ String alias; if ((alias = this.map.get(t)) == null) { - MinimalLogger.info(String.format("Creating new alias for %s...", - t)); alias = String.format("t.%d", this.type_num++); + MinimalLogger.info(String.format("Created alias %s for %s...", + alias, + t)); + this.map.put(t, alias); } diff --git a/st/MethodInstance.java b/st/MethodInstance.java index 9f1e6df..7ed0674 100644 --- a/st/MethodInstance.java +++ b/st/MethodInstance.java @@ -19,8 +19,7 @@ public class MethodInstance extends AbstractInstance { public boolean equals(Object other) { MethodInstance o; return (other instanceof MethodInstance && - ((o = (MethodInstance) other).getName() == this.getName() && - o.getParentClass() == this.getParentClass())); + ((o = (MethodInstance) other).getName() == this.getName())); } public ArrayList<TypeInstance> getArguments() { diff --git a/st/TokenKey.java b/st/TokenKey.java index 941c83f..948e06a 100644 --- a/st/TokenKey.java +++ b/st/TokenKey.java @@ -1,5 +1,7 @@ package st; +import misc.*; + /** * This class is a data structure used to distinguish tokens in * a given program. Tokens are considered unique if their "beginLine" @@ -28,6 +30,21 @@ public class TokenKey { @Override public boolean equals(Object other) { boolean ret = false; TokenKey o; + // if (other instanceof TokenKey) { + // o = (TokenKey) other; + // MinimalLogger.info(String.format("Comparing %s and %s", + // this.toString(), + // other.toString())); + // if ((o.cls == null && this.cls == null) || + // (o.cls != null && o.cls.equals(this.cls))) { + // MinimalLogger.info("Classes are equal!"); + // if ((o.mtd == null && this.mtd == null) || + // (o.mtd != null && o.mtd.equals(this.mtd))) { + // MinimalLogger.info("Methods are equal!"); + // if (o.name.equals(this.name)) { ret = true; } + // } else { MinimalLogger.info("Methods not equal."); } + // } else { MinimalLogger.info("Classes not equal."); } + // } if (other instanceof TokenKey && (o = (TokenKey) other).name.equals(this.name) && ((o.cls == null && this.cls == null) || |