diff options
author | bd-912 <bdunahu@colostate.edu> | 2024-04-15 15:19:54 -0600 |
---|---|---|
committer | bd-912 <bdunahu@colostate.edu> | 2024-04-15 15:19:54 -0600 |
commit | 04e9109f112f4cb7317416c2e31806f42663cb45 (patch) | |
tree | 9ae99f2bc5d5fbb41d731792b1d22a30f2e642b3 /boil/library/BoilSimp.java | |
parent | 056690e0e60d4d0ce046c171691aa02a7071eeae (diff) |
Allow MethodInstance to keep track of parent class
Diffstat (limited to 'boil/library/BoilSimp.java')
-rw-r--r-- | boil/library/BoilSimp.java | 35 |
1 files changed, 22 insertions, 13 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; } |