summaryrefslogtreecommitdiff
path: root/boil/library
diff options
context:
space:
mode:
Diffstat (limited to 'boil/library')
-rw-r--r--boil/library/BoilSimp.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/boil/library/BoilSimp.java b/boil/library/BoilSimp.java
index b5ea518..991319f 100644
--- a/boil/library/BoilSimp.java
+++ b/boil/library/BoilSimp.java
@@ -510,8 +510,7 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> {
String oper2 = n.f2.accept(this, symt);
TypeInstance tp1 = new TypeInstance("tp1", TypeEnum.ERROR);
- mod += String.format(" %s = AddS(%s %s)\n",
- this.tf.addNewAlias(tp1),
+ mod += String.format("Add(%s %s)",
oper1,
oper2);
@@ -588,6 +587,7 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> {
TypeInstance tp1 = new TypeInstance("tp1", TypeEnum.ERROR); // TypeFactory likes to know who it's renting to
TypeInstance tp2 = new TypeInstance("tp2", TypeEnum.ERROR);
+
TypeInstance cur = symt.getType(id);
int mtdIndex = cur.getClassInstance()
.getMethods().indexOf(symt.getMethod(id2)) * 4;
@@ -603,13 +603,26 @@ public class BoilSimp extends GJDepthFirst<String,SymbolTable> {
mtdIndex);
mod += n.f3.accept(this, symt);
- mod = n.f4.accept(this, symt);
+ String args = n.f4.accept(this, symt);
mod += n.f5.accept(this, symt);
- mod += String.format(" call %s(%s)\n",
+ TypeInstance tp3 = new TypeInstance("tp3", TypeEnum.ERROR);
+
+ if (!args.isEmpty())
+ mod += String.format(" %s = %s\n",
+ this.tf.addNewAlias(tp3),
+ args);
+
+ mod += String.format(" call %s(%s",
this.tf.retrieveAlias(tp2),
this.tf.retrieveAlias(cur));
+ if (!args.isEmpty())
+ mod += String.format(" %s",
+ this.tf.retrieveAlias(tp3));
+
+ mod += ")\n";
+
return mod;
}