diff options
Diffstat (limited to 'boil')
| -rw-r--r-- | boil/library/BoilVisitor.java | 20 | 
1 files changed, 18 insertions, 2 deletions
diff --git a/boil/library/BoilVisitor.java b/boil/library/BoilVisitor.java index 560dda8..7ae02b2 100644 --- a/boil/library/BoilVisitor.java +++ b/boil/library/BoilVisitor.java @@ -13,6 +13,8 @@ public class BoilVisitor extends GJDepthFirst<String,String> {      private int id;      private SymbolTable symt; +    private MethodInstance recentMethod = null; // the most recent method called +      public BoilVisitor(SymbolTable symt) {          this.symt = symt;          this.vapor = ""; @@ -930,6 +932,8 @@ public class BoilVisitor extends GJDepthFirst<String,String> {              MinimalLogger.info("Message send found an IDENTIFIER");              rhs = ((Identifier) n.f0.f0.choice).f0.tokenImage;              t = this.symt.getType(rhs); +            if (t == null) +                t = this.symt.getTypeAttr(rhs);              break;          case 4:              // we'll do everything here and exit the function @@ -952,6 +956,7 @@ public class BoilVisitor extends GJDepthFirst<String,String> {                                          this.tf.retrieveRecentList(this.symt.getMethod(mtd, cur)                                                                     .getArguments()                                                                     .size()))); +            this.recentMethod = this.symt.getMethod(mtd, cur);              return _ret;          case 6:              MinimalLogger.info("Message send found ANONYMOUS"); @@ -971,8 +976,18 @@ public class BoilVisitor extends GJDepthFirst<String,String> {                                          0,                                          rhs));              break; +        case 8: +            MinimalLogger.info("Message send found BRACKET"); +            rhs = n.f0.accept(this, argu); +            ClassInstance cls = this.recentMethod.getReturn(); +            t = new TypeInstance(this.getUniqueID(), TypeEnum.ERROR, +                                 (MethodInstance) this.symt.getActive(TypeEnum.method), +                                 (ClassInstance) this.symt.getActive(TypeEnum.classname)); +            t.addClassInstance(cls); +            break;          default: -            MinimalLogger.severe("Message send found UNKNOWN"); +            MinimalLogger.severe(String.format("Message send found UNKNOWN %s", +                                               n.f0.f0.choice.toString()));              rhs = null;              t = null;          } @@ -988,6 +1003,7 @@ public class BoilVisitor extends GJDepthFirst<String,String> {          MinimalLogger.info("Calculating method index to call...");          MinimalLogger.severe("t: " + t);          MinimalLogger.severe("t.getClassInstance() " + t.getClassInstance()); +        this.recentMethod = this.symt.getMethod(mtd, t.getClassInstance());          int mtdIndex = t.getClassInstance().getMethods()              .indexOf(this.symt.getMethod(mtd, t.getClassInstance())) * 4; @@ -1227,7 +1243,7 @@ public class BoilVisitor extends GJDepthFirst<String,String> {       * f1 -> Expression()       */      public String visit(NotExpression n, String argu) { -        String _ret=null; +        String _ret="";          MinimalLogger.info(String.format("-> %s",                                           n.getClass().getSimpleName()));          _ret += this.tf.alias(this.getUniqueID());  | 
