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());
}