public static AbstractType EvaluateType(IExpression x, ResolutionContext ctxt) { var ev = new Evaluation(ctxt); ISemantic t = null; if(!Debugger.IsAttached) try { t = ev.E(x); } catch { } else t = ev.E(x); return AbstractType.Get(t); }
/// <summary> /// Since most expressions should return a single type only, it's not needed to use this function unless you might /// want to pay attention on (illegal) multiple overloads. /// </summary> public static AbstractType[] EvaluateTypes(IExpression x, ResolutionContext ctxt) { var ev = new Evaluation(ctxt); ISemantic t = null; if(!Debugger.IsAttached) try { t = ev.E(x); } catch { } else t = ev.E(x); if (t is InternalOverloadValue) return ((InternalOverloadValue)t).Overloads; return t == null ? null : new[]{ AbstractType.Get(t) }; }
public static ISymbolValue EvaluateValue(IExpression x, AbstractSymbolValueProvider vp) { if (vp == null) vp = new StandardValueProvider(null); var ev = new Evaluation(vp); var v = ev.E(x) as ISymbolValue; if(v == null && ev.Errors.Count != 0) return new ErrorValue(ev.Errors.ToArray()); return v; }