Ejemplo n.º 1
0
        public override IR implicitCast(IR i, DataType to, IRList list)
        {
            if (!(to is DataType_Reference))
            {
                return(null);
            }
            DataType_Struct iterator = this;

            while (iterator != null)
            {
                if (iterator == to)
                {
                    return(list.Add(IR.cast <IR_Reinterpret>(i, to, null)));
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        public override IR getMember(IR i, string name, IRList list)
        {
            int             index;
            DataType_Struct iterator = this;

            while (iterator != null)
            {
                if (iterator.memberMap.TryGetValue(name, out index))
                {
                    IR _struct = i;
                    if (iterator != this)
                    {
                        _struct = list.Add(IR.cast <IR_Reinterpret>(i, iterator, null));
                    }
                    return(list.Add(IR.getMember(_struct, iterator.members[index], index + (iterator.inherits == null ? 0 : 1))));
                }
                iterator = iterator.inherits;
            }
            return(null);
        }