コード例 #1
0
    internal override void Walk()
    {
        CCTypeSet cts = Stack.Peek(0);

        Stack.Peek(1).CheckInt();
        CCTypeSet mv = null;

        foreach (CCType tos in cts)
        {
            tos.xType.CheckExtends(owner);
            CCType    tos2 = tos.GetEmbedded(owner);
            CCStruct  cs   = CCStruct.Lookup(tos2);
            CCTypeSet vt   = cs.Get(0);
            if (vt != null)
            {
                if (mv == null)
                {
                    mv = vt;
                }
                else
                {
                    mv = CCTypeSet.Merge(mv, vt);
                }
            }
        }
        if (mv != null)
        {
            next.MergeStack(Stack.Pop(2).Push(mv));
        }
    }
コード例 #2
0
    internal override void Walk()
    {
        /*
         * For all possible types of the TOS:
         *
         *  1. Verify that the accessor is usable on that type.
         *
         *  2. Obtain the right CCStruct, and get the types
         *     that may be thus obtained. The "right CCStruct"
         *     is the one for the CCType that matches the
         *     element type, and the allocation node and variant
         *     of the type found on the stack.
         *
         *  3. Merge all resulting types.
         */
        CCTypeSet cts = Stack.Peek(0);
        CCTypeSet mv  = null;

        foreach (CCType tos in cts)
        {
            tos.xType.CheckExtends(owner);
            CCType    tos2 = tos.GetEmbedded(owner);
            CCStruct  cs   = CCStruct.Lookup(tos2);
            CCTypeSet vt   = cs.Get(owner.fieldInverseMapping[off]);
            if (vt != null)
            {
                if (mv == null)
                {
                    mv = vt;
                }
                else
                {
                    mv = CCTypeSet.Merge(mv, vt);
                }
            }
        }
        if (mv != null)
        {
            next.MergeStack(Stack.Pop().Push(mv));
        }
    }