diff options
Diffstat (limited to 'boil/library')
-rw-r--r-- | boil/library/BoilSimp.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/boil/library/BoilSimp.java b/boil/library/BoilSimp.java index 8d36c8e..6d8e401 100644 --- a/boil/library/BoilSimp.java +++ b/boil/library/BoilSimp.java @@ -275,11 +275,16 @@ public class BoilSimp extends GJDepthFirst<String,String> { n.f6.accept(this, args); // spill out all class attributes, if they're not used, who cares - for (TypeInstance attr : this.symt.getMethod(id) - .getClassInstance() - .getLocals()) { - this.vapor += String.format(" %s = this\n", - this.tf.alias(attr.getName())); + this.vapor += String.format(" %s = this\n", + this.tf.alias(Integer.toString(this.id++))); + ClassInstance parent = this.symt.getMethod(id).getClassInstance(); + int attr_index = parent.getMethods().size() * 4; + for (TypeInstance attr : parent.getLocals()) { + this.vapor += String.format(" %s = [%s+%d]\n", + this.tf.alias(attr.getName()), + this.tf.alias(Integer.toString(this.id-1)), + attr_index); + attr_index += 4; } n.f7.accept(this, args); @@ -296,7 +301,6 @@ public class BoilSimp extends GJDepthFirst<String,String> { TypeInstance sym = this.symt.getType(((Identifier) ((PrimaryExpression) n.f10.f0.choice).f0.choice).f0.tokenImage); ClassInstance cls = symt.getClass(symt.getActive(TypeEnum.classname)); - int attr_index; if ((attr_index = this.getVarIndex(cls, sym)) >=0) { ret = String.format("[%s+%d]", ret, @@ -440,9 +444,7 @@ public class BoilSimp extends GJDepthFirst<String,String> { ClassInstance cls = this.symt.getClass(this.symt.getActive(TypeEnum.classname)); int attr_index = 0; - if (expr.contains("functable") || // is this an allocation... :) - (attr_index = this.getVarIndex(cls, t)) >=0 - + if (expr.contains("functable") // is this an allocation... :) ) { lhs = String.format("[%s+%d]", lhs, |