Ejemplo n.º 1
0
        public virtual void Visit(CustomModifier customModifier)
        {
            if (customModifier.Modifier != null)
            {
                Visit(customModifier.Modifier);
            }

            Visit(customModifier.ElementType);
        }
Ejemplo n.º 2
0
        internal static TypeSignature Load(IBinaryAccessor accessor, Module module)
        {
            int elementType = accessor.ReadCompressedInteger();

            switch (elementType)
            {
            case Metadata.ElementType.Class:
                return(TypeReference.LoadClass(accessor, module));

            case Metadata.ElementType.ValueType:
                return(TypeReference.LoadValueType(accessor, module));

            case Metadata.ElementType.ByRef:
                return(ByRefType.LoadByRef(accessor, module));

            case Metadata.ElementType.Ptr:
                return(PointerType.LoadPtr(accessor, module));

            case Metadata.ElementType.FnPtr:
                return(FunctionPointer.LoadFnPtr(accessor, module));

            case Metadata.ElementType.Array:
                return(ArrayType.LoadArray(accessor, module));

            case Metadata.ElementType.SzArray:
                return(ArrayType.LoadSzArray(accessor, module));

            case Metadata.ElementType.Var:
                return(GenericParameterType.LoadVar(accessor, module));

            case Metadata.ElementType.MVar:
                return(GenericParameterType.LoadMVar(accessor, module));

            case Metadata.ElementType.GenericInst:
                return(GenericTypeReference.LoadGeneric(accessor, module));

            case Metadata.ElementType.CModOpt:
                return(CustomModifier.LoadModOpt(accessor, module));

            case Metadata.ElementType.CModReqD:
                return(CustomModifier.LoadModReq(accessor, module));

            case Metadata.ElementType.Pinned:
                return(PinnedType.LoadPinned(accessor, module));

            default:
                return(TypeReference.GetPrimitiveType(elementType, module.Assembly));
            }
        }
Ejemplo n.º 3
0
        public virtual bool Predicate(CustomModifier customModifier)
        {
            if (customModifier.Modifier != null)
            {
                if (_defaultValue != Predicate(customModifier.Modifier))
                {
                    return(!_defaultValue);
                }
            }

            if (_defaultValue != Predicate(customModifier.ElementType))
            {
                return(!_defaultValue);
            }

            return(_defaultValue);
        }
Ejemplo n.º 4
0
        public virtual bool Build(ref CustomModifier customModifier)
        {
            bool changed = false;

            var modifier = customModifier.Modifier;

            if (modifier != null)
            {
                changed |= Build(ref modifier);
            }

            var elementType = customModifier.ElementType;

            changed |= Build(ref elementType);

            if (!changed)
            {
                return(false);
            }

            customModifier = new CustomModifier(elementType, modifier, customModifier.ModifierType);
            return(true);
        }
 public virtual void Visit(CustomModifier customModifier)
 {
     Visit(customModifier.Modifier);
     Visit(customModifier.ElementType);
 }