public override object Eval(IExecutionContext context) { if(IsInitializer) { context.InitVariable(Name); } object result = context.GetVariable(Name); if(result == SpecialValue.VariableNotSet) throw new VariableNotInitialized(Name); return result; }
private static Dictionary<IValue, IValue> GetDictionary(IExecutionContext ctx) { return ctx.GetVariable("+object", false).Value.GetValue<Dictionary<IValue, IValue>>(); }
public static IValue Set(IExecutionContext ctx, IList<IArgument> arguments) { var args = CommandUtilities.ManageArguments(arguments) .Exactly(2) .CanConvert<string>(0) .Results(); ctx.GetVariable(args[0].GetValue<string>()).Value = args[1]; return new GenericValue<bool>(true); }
protected override IValue Execute(IExecutionContext ctx) { return ctx.GetVariable(this.Variable).Value; }
public static IValue Get(IExecutionContext ctx, IList<IArgument> arguments) { var args = CommandUtilities.ManageArguments(arguments) .Exactly(1) .CanConvert<string>(0) .Results(); return ctx.GetVariable(args[0].GetValue<string>()).Value; }