public Scope Copy() { Scope cp = new Scope(Parent == null ? null : Parent.Copy()); foreach (var kvp in Variables) cp.Variables.Add(kvp.Key, kvp.Value.Copy()); return cp; }
public Value Evaluate(Scope scope) { // create child scope Scope child = new Scope(scope); Value final = new ForeverAlone(); try { foreach (var ie in Body) final = ie.Evaluate(child); } catch (Gb2 gb2) { return gb2.Value.Evaluate(scope); } return final; }
public Value Evaluate(Scope scope) { foreach (var t in Tiers) { if (t.Item1 == null) // SHIT TIER return t.Item2.Evaluate(scope); var res = t.Item1.Evaluate(scope); if (res.Type != GPLType.Bool) throw new Exception("Non-boolean expression inside TIER list"); if (((Bool)res).Value) // evaluated to true return t.Item2.Evaluate(scope); } return new ForeverAlone(); // no conditions met true }
public Value Evaluate(Scope scope) { return scope.Find(Identifier); }
public override Value Evaluate(Scope scope) { return scope.Find(Name, Value.Evaluate(scope)); }
public virtual Value Evaluate(Scope scope) { return scope.Create(Name, new ForeverAlone()); }
public Scope(Scope parent) { this.Parent = parent; this.Variables = new Dictionary<string, Value>(); }
public Value Evaluate(Scope scope) { return this; }
public Function(IExpression body, Scope scope, List<string> names) { this.Body = body; this.Execution = scope; this.Names = names; }