summaryrefslogtreecommitdiff
path: root/boil/library/BoilSimp.java
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-11 11:51:19 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-11 11:51:19 -0600
commitb0ddefd7e9a05905668bcef7110c623883e05c86 (patch)
tree4b068852bc2a0ade0186d0826b97f65d34e7d40a /boil/library/BoilSimp.java
parent1080b37bbe40fe56b919d22804c159cccdca3c95 (diff)
Very simple argument passing Boil.MessageSend
Diffstat (limited to 'boil/library/BoilSimp.java')
-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;
}