Exemplo n.º 1
0
    public static object SetPropaty(ELEMENT e, object[] args, xmlScriptObj scrObj, STACKVAL stack)
    {
        var len = e.GetPointerCount(true);
        var n0  = e.GetPointerName(true);
        var n1  = len > 1 ?  e.GetPointerNext().GetPointerName(true) : null;

        int    index = 0;
        object p     = null;

        {
            var val = e.GetPointerVARIABLE();
            if (val != null)
            {
                object o = null;
                if (xmlScriptExecVar.ExecuteValiable_GetFromStack(val, (xmlScriptObj)scrObj, stack, out o))
                {
                    p = o;
                    if (p != null)
                    {
                        index = 1;
                    }
                }
            }
        }

        if (p == null && scrObj != null)
        {
            //p = __ObjectGetPropaty(baseObj,n0);
            p = _ObjectGetPropaty(scrObj, e, scrObj, stack);
            if (p != null)
            {
                index = 1;
            }
        }

        if (p == null)
        {
            if (len == 2)
            {
                return(_StaticSetPropaty(n0, n1, args));
            }
            p = _StaticGetPropaty(n0, n1);
            if (p != null)
            {
                index = 2;
            }
        }

        if (p == null)
        {
            return(null);
        }

        if (index < len - 1)
        {
            for (int i = index; i < len - 1; i++)
            {
                var ne = e.GetPointerNext(i);
                var pn = ne.GetPointerName(true);
                p = __ObjectGetPropaty(ne, p, pn);
                if (p == null)
                {
                    break;
                }
            }
        }

        var setelem = e.GetPointerNext(len - 1);
        var setname = setelem.GetPointerName(true); //names[names.Length-1];

        return(_ObjectSetPropaty(setelem, p, setname, args));
    }
Exemplo n.º 2
0
    public static object GetPropaty(ELEMENT e, xmlScriptObj scrObj, STACKVAL stack)
    {
        var len = e.GetPointerCount(true);
        var n0  = e.GetPointerName(true);
        var n1  = len > 1 ?  e.GetPointerNext().GetPointerName(true) : null;

        int    index = 0;
        object p     = null;

        {
            var val = e.GetPointerVARIABLE();
            if (val != null)
            {
                object o = null;
                if (xmlScriptExecVar.ExecuteValiable_GetFromStack(val, (xmlScriptObj)scrObj, stack, out o))
                {
                    p = o;
                    if (p != null)
                    {
                        index = 1;
                    }
                }
            }
        }

        if (p == null && scrObj != null)
        {
            p = _ObjectGetPropaty(scrObj, e, scrObj, stack);
            if (p != null)
            {
                index = 1;
            }
        }

        if (p == null)
        {
            p = _StaticGetPropaty(n0, n1);
            if (p != null)
            {
                index = 2;
            }
        }

        if (p == null)
        {
            return(null);
        }

        if (index < len)
        {
            for (int i = index; i < len; i++)
            {
                var ne = e.GetPointerNext(i);
                var pn = ne.GetPointerName(true);
                p = _ObjectGetPropaty(p, ne, scrObj, stack);

                if (p == null)
                {
                    break;
                }
            }
        }
        return(p);
    }