diff options
Diffstat (limited to 'boil/library')
-rw-r--r-- | boil/library/BoilSimp.java | 35 | ||||
-rw-r--r-- | boil/library/TypeFactory.java | 2 |
2 files changed, 23 insertions, 14 deletions
diff --git a/boil/library/BoilSimp.java b/boil/library/BoilSimp.java index 9e8d40a..fe54052 100644 --- a/boil/library/BoilSimp.java +++ b/boil/library/BoilSimp.java @@ -243,6 +243,15 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { mod += String.format("%s)\n", args); mod += n.f5.accept(this, symt); mod += n.f6.accept(this, symt); + + // spill out all class attributes, if they're not used, who cares + for (TypeInstance attr : symt.getMethod(id) + .getClassInstance() + .getLocals()) { + mod += String.format(" %s = this\n", + this.tf.alias(attr)); + } + mod += n.f7.accept(this, symt); mod += n.f8.accept(this, symt); mod += n.f9.accept(this, symt); @@ -451,9 +460,14 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { String mod = ""; mod += n.f0.accept(this, symt); mod += n.f1.accept(this, symt); - mod += n.f2.accept(this, symt); + String expr = n.f2.accept(this, symt); mod += n.f3.accept(this, symt); mod += n.f4.accept(this, symt); + TypeInstance tp1 = new TypeInstance("tp1", TypeEnum.ERROR); + + // mod += String.format(" %s = %s\n", + // this.tf.alias(tp1), + // expr); mod += String.format(" PrintIntS(%s)\n", this.tf.retrieveRecentList(1)); @@ -622,19 +636,14 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> { mod += n.f4.accept(this, symt); mod += n.f5.accept(this, symt); - String call = String.format("call %s(%s", - this.tf.alias(tp2), - this.tf.alias(cur)); - - call += String.format(" %s)", - this.tf.retrieveRecentList(symt.getMethod(id2) - .getArguments() - .size())); + mod += String.format("call %s(%s", + this.tf.alias(tp2), + this.tf.alias(cur)); - TypeInstance tp3 = new TypeInstance("tp3", TypeEnum.ERROR); - mod += String.format(" %s = %s\n", - this.tf.alias(tp3), - call); + mod += String.format(" %s)", + this.tf.retrieveRecentList(symt.getMethod(id2) + .getArguments() + .size())); return mod; } diff --git a/boil/library/TypeFactory.java b/boil/library/TypeFactory.java index 432fc0f..be77f63 100644 --- a/boil/library/TypeFactory.java +++ b/boil/library/TypeFactory.java @@ -35,7 +35,7 @@ public class TypeFactory { String rtn = ""; rtn += String.format("t.%d", type_num-x); - for (int i = type_num-(x+1); i < type_num; ++i) { + for (int i = type_num-(x-1); i < type_num; ++i) { rtn += String.format(" t.%d", i); } |