From b0ddefd7e9a05905668bcef7110c623883e05c86 Mon Sep 17 00:00:00 2001 From: bd-912 Date: Thu, 11 Apr 2024 11:51:19 -0600 Subject: Very simple argument passing Boil.MessageSend --- boil/library/BoilSimp.java | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'boil/library/BoilSimp.java') 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 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 { 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 { 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; } -- cgit v1.2.3