Exemplo n.º 1
0
        public static bool HostTypeAssign(VAL R0, VAL R1)
        {
            /***
             *
             * CASE 2:
             *      textbox1.Text ="Hello";
             *
             * */
            if (R0.temp != null && R0.temp is HostOffset)
            {
                HostOffset hosts  = (HostOffset)R0.temp;
                object     host   = hosts.host;
                object     offset = hosts.offset;

                if (offset is MethodInfo)
                {
                    return(false);
                }

                return(HostTypeAssign(host, offset, R1.HostValue, R1.hty == HandlerActionType.Add));
            }



            return(false);
        }
Exemplo n.º 2
0
        public static VAL HostTypeFunction(VAL proc, VALL parameters)
        {
            VAL ret = VAL.VOID;

            if (proc.ty == VALTYPE.hostcon && (proc.value is MethodInfo || proc.value is MethodInfo[]))
            {
                HostOffset temp   = (HostOffset)proc.temp;
                object     host   = temp.host;
                object     offset = temp.offset;

                if (offset is MethodInfo)
                {
                    ret = VAL.Boxing1(((MethodInfo)proc.value).Invoke(host, parameters.ObjectArray));
                }
                else
                {
                    HostFunction hFunc = new HostFunction(host, (string)offset, parameters);

                    if (proc.value is MethodInfo[])
                    {
                        ret = hFunc.RunFunction((MethodInfo[])proc.value);
                    }
                    else
                    {
                        MethodInfo method = (MethodInfo)proc.value;
                        if (method.IsGenericMethod)
                        {
                            ret = hFunc.RunFunction(new MethodInfo[] { method });
                        }
                        else
                        {
                            ret = hFunc.RunFunction();
                        }
                    }
                }
            }
            else if (proc.value is Delegate)
            {
                Delegate   d         = (Delegate)proc.value;
                MethodInfo method    = d.Method;
                object[]   arguments = parameters.ObjectArray;
                return(HostFunction.InvokeMethod(method, d.Target, arguments));
            }
            return(ret);
        }