Ejemplo n.º 1
0
        public override Object Evaluate(Executer exec)
        {
            object[]      args     = new object[this.Arguments.Count];
            System.Type[] argTypes = new Type[this.Arguments.Count];
            for (int i = 0; i < this.Arguments.Count; i++)
            {
                Expression expr = (Expression)this.Arguments[i];
                //terms for functions *always* have an Expression and no Value.
                args[i]     = expr.Evaluate(exec).GetUnboxed(exec);
                argTypes[i] = args[i].GetType();
            }

            if (this.BelongsToObject == null)
            {
                this.BelongsToObject = MemberSearch.FindMethodObject(this.Name, argTypes);
            }

            if (this.BelongsToObject.GetType() == typeof(Nodes.ClassNode))
            {
                Nodes.MethodNode method = ((Nodes.ClassNode) this.BelongsToObject).GetMethod(this.Name);
                //TODO: arguments can't be set like this - another thread may call the same
                //method *while* this call is in execution, so arguments must be put on a stack!
                method.SetArguments(args);
                Executer exe = new Executer(method);
                object   o   = exe.Run();             //method.Execute();
                return(Object.CreateType(o));
            }
            return(Object.CreateType(Endogine.Serialization.Access.CallMethod(
                                         this.BelongsToObject, this.Name, args)));
        }
Ejemplo n.º 2
0
        public override Object Evaluate(Executer exec)
        {
            //EH.Put("var:"+this.Name);
            //this.ValueWrapper = null;
            object oNewVal = this.EvaluateToWrapper(exec).Value;

            return(Object.CreateType(oNewVal));
        }