Package edu.mit.csail.sdg.alloy4compiler.ast

Examples of edu.mit.csail.sdg.alloy4compiler.ast.ExprBad


     * @param warnings - the list that will receive any warning we generate; can be null if we wish to ignore warnings
     */
    Expr instantiate(Context cx, List<ErrorWarning> warnings) throws Err {
        if (cx.unrolls<=0) {
            Pos p = span();
            return new ExprBad(p, toString(), new ErrorType(p, "Macro substitution too deep; possibly indicating an infinite recursion."));
        }
        if (params.size() != args.size()) return this;
        Context cx2 = new Context(realModule, warnings, cx.unrolls-1);
        for(int n=params.size(), i=0; i<n; i++) {
            Expr tmp = args.get(i);
View Full Code Here


               Macro mac = m.macros.get(name);
               if (mac==null) continue;
               if (match!=null) ambiguous=true; else match=mac;
               sb.append("\n").append(m.path.length()==0 ? "this" : m.path).append("/").append(name);
            }
            if (ambiguous) return new ExprBad(pos, name, new ErrorType(pos, "There are multiple macros with the same name:"+sb));
         }
         if (match==null) match = rootmodule.globals.get(name);
         if (match!=null) {
            if (match instanceof Macro) return ((Macro)match).changePos(pos);
            match = ExprUnary.Op.NOOP.make(pos, match);
            return ExprChoice.make(pos, asList(match), asList(name));
         }
         Expr th = env.get("this");
         if (th!=null) th = ExprUnary.Op.NOOP.make(pos, th);
         TempList<Expr> ch = new TempList<Expr>();
         TempList<String> re = new TempList<String>();
         Expr ans = rootmodule.populate(ch, re, rootfield, rootsig, rootfunparam, rootfunbody, pos, name, th);
         if (ans!=null) return ans;
         if (ch.size()==0) return new ExprBad(pos, name, hint(pos, name)); else return ExprChoice.make(pos, ch.makeConst(), re.makeConst());
      }
View Full Code Here

TOP

Related Classes of edu.mit.csail.sdg.alloy4compiler.ast.ExprBad

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.