public static string EvaluateAsName(IExpression expression, ValueEnvironment environment) { if (expression == null) { return(null); } if (expression is NameExpression) { return(((NameExpression)expression).Name); } if (expression is DotExpression) { DotExpression dot = (DotExpression)expression; return(EvaluateAsName(dot.Expression, environment) + "." + dot.Name); } object result = expression.Evaluate(environment); if (result == null) { return(null); } return(result.ToString()); }
public static Type GetType(ValueEnvironment environment, string name) { object obj = environment.GetValue(name); if (obj != null && obj is Type) { return((Type)obj); } return(GetType(name)); }
public void SetValue(string key, object value) { key = key.ToLower(); if (this.values.ContainsKey(key)) { this.values[key] = value; return; } ValueEnvironment environment = this.GetNonLocalEnvironmentContaining(key); if (environment != null) { environment.SetValue(key, value); return; } this.values[key] = value; }
public Machine(ValueEnvironment environment) { this.environment = environment; }
public ValueEnvironment(ValueEnvironment parent, ValueEnvironmentType type) { this.parent = parent; this.type = type; }
public ValueEnvironment(ValueEnvironment parent) : this(parent, ValueEnvironmentType.Normal) { }