Esempio n. 1
0
        /// <summary>
        /// Matches the specified other.
        /// </summary>
        /// <param name="other">The other signature type.</param>
        /// <returns>True, if the signature type matches.</returns>
        public override bool Matches(SigType other)
        {
            RefSigType refOther = other as RefSigType;

            // FIXME: Do we need to consider custom mods here?
            return(refOther != null && refOther.elementType.Matches(this.ElementType) == true);
        }
Esempio n. 2
0
        /// <summary>
        /// Indicates whether the current object is equal to another object of the same type.
        /// </summary>
        /// <param name="other">An object to compare with this object.</param>
        /// <returns>
        /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
        /// </returns>
        public override bool Equals(SigType other)
        {
            RefSigType rst = other as RefSigType;

            if (null == rst)
            {
                return(false);
            }

            return(base.Equals(other) && this.elementType.Matches(rst.elementType) == true);
        }
        /// <summary>
        /// Decodes the specified instruction.
        /// </summary>
        /// <param name="ctx">The context.</param>
        /// <param name="decoder">The instruction decoder, which holds the code stream.</param>
        public override void Decode(Context ctx, IInstructionDecoder decoder)
        {
            base.Decode(ctx, decoder);

            TokenTypes token = decoder.DecodeTokenType();

            ctx.RuntimeField = decoder.ModuleTypeSystem.GetField(token);

            if (ctx.RuntimeField.ContainsGenericParameter)
            {
                ;
            }

            SigType sigType = new RefSigType(ctx.RuntimeField.SignatureType);
            ctx.Result = LoadInstruction.CreateResultOperand(decoder, Operand.StackTypeFromSigType(sigType), sigType);
        }
        /// <summary>
        /// Decodes the specified instruction.
        /// </summary>
        /// <param name="ctx">The context.</param>
        /// <param name="decoder">The instruction decoder, which holds the code stream.</param>
        public override void Decode(Context ctx, IInstructionDecoder decoder)
        {
            base.Decode(ctx, decoder);

            Token token = decoder.DecodeTokenType();

            ITypeModule module = null;
            Mosa.Runtime.TypeSystem.Generic.CilGenericType genericType = decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType;
            if (genericType != null)
                module = (decoder.Method.DeclaringType as Mosa.Runtime.TypeSystem.Generic.CilGenericType).BaseGenericType.Module;
            else
                module = decoder.Method.Module;
            ctx.RuntimeField = module.GetField(token);

            if (ctx.RuntimeField.ContainsGenericParameter)
            {
                ;
            }

            SigType sigType = new RefSigType(ctx.RuntimeField.SignatureType);
            ctx.Result = LoadInstruction.CreateResultOperand(decoder, Operand.StackTypeFromSigType(sigType), sigType);
        }