예제 #1
0
        private object MinusEqual(IScriptContext context)
        {
            object rez = context.Result;

            nameExpr.Evaluate(context);

            object rezName = context.Result;

            HandleOperatorArgs handling = OnHandleOperator(this, context, "-=", rezName, rez);

            if (handling.Cancel)
            {
                rez = handling.Result;
            }
            else
            {
                rez = minus.Evaluate(rezName, rez);
            }

            //if (!(rezName is EventInfo))
            //{
            //  rez = RuntimeHost.GetBinaryOperator("-").Evaluate(rezName, rez);
            //}
            //else
            //{
            //  rez = new RemoveDelegate((IInvokable)rez);
            //}
            nameExpr.Assign(rez, context);
            return(rez);
        }
예제 #2
0
        private object PlusEqual(IScriptContext context)
        {
            object rez = context.Result;

            nameExpr.Evaluate(context);
            object rezName = context.Result;

            HandleOperatorArgs handling = OnHandleOperator(this, context, "+=", rezName, rez);

            if (handling.Cancel)
            {
                rez = handling.Result;
            }
            else
            {
                rez = plus.Evaluate(rezName, rez);
            }

            //TODO: Events!
            //if (!(rezName is EventInfo))
            //{
            //  rez = RuntimeHost.GetBinaryOperator("+").Evaluate(rezName, rez);
            //}

            nameExpr.Assign(rez, context);
            return(rez);
        }
예제 #3
0
파일: ScriptExpr.cs 프로젝트: singba/SSharp
        protected static HandleOperatorArgs OnHandleOperator(object sender, IScriptContext context, string symbol, params object[] parameters)
        {
            var args = new HandleOperatorArgs(context, symbol, parameters);

            if (HandleOperator != null)
            {
                HandleOperator.Invoke(sender, args);
            }

            return(args);
        }
예제 #4
0
파일: Runtime.cs 프로젝트: singba/SSharp
            public object Process(HandleOperatorArgs args)
            {
                if (args.Arguments != null && args.Arguments.Length == 1)
                {
                    string value = (string)args.Arguments[0];
                    args.Cancel = true;
                    return(int.Parse(value));
                }

                throw new NotSupportedException();
            }
예제 #5
0
        public override void Evaluate(IScriptContext context)
        {
            expr.Evaluate(context);

            HandleOperatorArgs handler = OnHandleOperator(this, context, oper, context.Result);

            if (handler.Cancel)
            {
                context.Result = handler.Result;
            }
            else
            {
                context.Result = RuntimeHost.GetUnaryOperator(oper).Evaluate(context.Result);
            }
            //Context.EvaluateUnaryOperator(oper, Context.Result);
        }
예제 #6
0
        private object AssignEx(IScriptContext context)
        {
            object rez = context.Result;

            nameExpr.Evaluate(context);

            HandleOperatorArgs handling = OnHandleOperator(this, context, ":=", context.Result, rez);

            if (handling.Cancel)
            {
                rez = handling.Result;
            }
            else
            {
                ((ISupportAssign)rez).AssignTo(context.Result);
                rez = context.Result;
            }

            return(rez);
        }