示例#1
0
 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;
 }
示例#2
0
 private static Dictionary<IValue, IValue> GetDictionary(IExecutionContext ctx)
 {
     return ctx.GetVariable("+object", false).Value.GetValue<Dictionary<IValue, IValue>>();
 }
示例#3
0
        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);
        }
示例#4
0
 protected override IValue Execute(IExecutionContext ctx)
 {
     return ctx.GetVariable(this.Variable).Value;
 }
示例#5
0
        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;
        }