Beispiel #1
0
 public OptionalModifierType(TypeReference modifierType, TypeReference type)
     : base(type)
 {
     Mixin.CheckModifier (modifierType, type);
     this.modifier_type = modifierType;
     this.etype = MD.ElementType.CModOpt;
 }
Beispiel #2
0
 public MethodDefinition(string name, MethodAttributes attributes, TypeReference returnType)
     : base(name, returnType)
 {
     this.attributes = (ushort) attributes;
     this.HasThis = !this.IsStatic;
     this.token = new MetadataToken (TokenType.Method);
 }
Beispiel #3
0
        internal ParameterReference(string name, TypeReference parameterType)
        {
            if (parameterType == null)
                throw new ArgumentNullException ("parameterType");

            this.name = name ?? string.Empty;
            this.parameter_type = parameterType;
        }
Beispiel #4
0
        public FieldReference(string name, TypeReference fieldType, TypeReference declaringType)
            : this(name, fieldType)
        {
            if (declaringType == null)
                throw new ArgumentNullException("declaringType");

            this.DeclaringType = declaringType;
        }
Beispiel #5
0
        public MethodReference(string name, TypeReference returnType, TypeReference declaringType)
            : this(name, returnType)
        {
            if (declaringType == null)
                throw new ArgumentNullException ("declaringType");

            this.DeclaringType = declaringType;
        }
Beispiel #6
0
        protected EventReference(string name, TypeReference eventType)
            : base(name)
        {
            if (eventType == null)
                throw new ArgumentNullException ("eventType");

            event_type = eventType;
        }
Beispiel #7
0
        internal PropertyReference(string name, TypeReference propertyType)
            : base(name)
        {
            if (propertyType == null)
                throw new ArgumentNullException ("propertyType");

            property_type = propertyType;
        }
Beispiel #8
0
        public CallSite(TypeReference returnType)
            : this()
        {
            if (returnType == null)
                throw new ArgumentNullException ("returnType");

            this.signature.ReturnType = returnType;
        }
Beispiel #9
0
        public FieldReference(string name, TypeReference fieldType)
            : base(name)
        {
            if (fieldType == null)
                throw new ArgumentNullException ("fieldType");

            this.field_type = fieldType;
            this.token = new MetadataToken (TokenType.MemberRef);
        }
Beispiel #10
0
        public MethodReference(string name, TypeReference returnType)
            : base(name)
        {
            if (returnType == null)
                throw new ArgumentNullException ("returnType");

            this.return_type = new MethodReturnType (this);
            this.return_type.ReturnType = returnType;
            this.token = new MetadataToken (TokenType.MemberRef);
        }
Beispiel #11
0
        public void AddVariableIndex()
        {
            var object_ref = new TypeReference ("System", "Object", null, null, false);
            var method = new MethodDefinition ("foo", MethodAttributes.Static, object_ref);
            var body = new MethodBody (method);

            var x = new VariableDefinition ("x", object_ref);
            var y = new VariableDefinition ("y", object_ref);

            body.Variables.Add (x);
            body.Variables.Add (y);

            Assert.AreEqual (0, x.Index);
            Assert.AreEqual (1, y.Index);
        }
Beispiel #12
0
        public void AddInstruction()
        {
            var object_ref = new TypeReference ("System", "Object", null, null, false);
            var method = new MethodDefinition ("foo", MethodAttributes.Static, object_ref);
            var body = new MethodBody (method);

            var il = body.GetILProcessor ();

            var first = il.Create (OpCodes.Nop);
            var second = il.Create (OpCodes.Nop);

            body.Instructions.Add (first);
            body.Instructions.Add (second);

            Assert.IsNull (first.Previous);
            Assert.AreEqual (second, first.Next);
            Assert.AreEqual (first, second.Previous);
            Assert.IsNull (second.Next);
        }
Beispiel #13
0
 public static void CheckType(TypeReference type)
 {
     if (type == null)
         throw new ArgumentNullException ("type");
 }
Beispiel #14
0
 public GenericInstanceType(TypeReference type)
     : base(type)
 {
     base.IsValueType = type.IsValueType;
     this.etype = MD.ElementType.GenericInst;
 }
Beispiel #15
0
 public RequiredModifierType(TypeReference modifierType, TypeReference type)
     : base(type)
 {
     Mixin.CheckModifier (modifierType, type);
     this.modifier_type = modifierType;
     this.etype = MD.ElementType.CModReqD;
 }
Beispiel #16
0
 public static void CheckModifier(TypeReference modifierType, TypeReference type)
 {
     if (modifierType == null)
         throw new ArgumentNullException ("modifierType");
     if (type == null)
         throw new ArgumentNullException ("type");
 }
Beispiel #17
0
 public PropertyDefinition(string name, PropertyAttributes attributes, TypeReference propertyType)
     : base(name, propertyType)
 {
     this.attributes = (ushort) attributes;
     this.token = new MetadataToken (TokenType.Property);
 }
Beispiel #18
0
 public PointerType(TypeReference type)
     : base(type)
 {
     Mixin.CheckType (type);
     this.etype = MD.ElementType.Ptr;
 }
Beispiel #19
0
 public ArrayType(TypeReference type)
     : base(type)
 {
     Mixin.CheckType (type);
     this.etype = MD.ElementType.Array;
 }
Beispiel #20
0
 public ParameterDefinition(string name, ParameterAttributes attributes, TypeReference parameterType)
     : base(name, parameterType)
 {
     this.attributes = (ushort) attributes;
     this.token = new MetadataToken (TokenType.Param);
 }
Beispiel #21
0
 public ParameterDefinition(TypeReference parameterType)
     : this(string.Empty, ParameterAttributes.None, parameterType)
 {
 }
Beispiel #22
0
 public SentinelType(TypeReference type)
     : base(type)
 {
     Mixin.CheckType (type);
     this.etype = MD.ElementType.Sentinel;
 }
Beispiel #23
0
 TypeReference LookupSystemValueType(ref TypeReference typeRef, string name, ElementType element_type)
 {
     lock (module.SyncRoot) {
         if (typeRef != null)
             return typeRef;
         var type = LookupType ("System", name);
         type.etype = element_type;
         type.IsValueType = true;
         return typeRef = type;
     }
 }
Beispiel #24
0
 TypeReference LookupSystemType(ref TypeReference reference, string name, ElementType element_type)
 {
     lock (module.SyncRoot) {
         if (reference != null)
             return reference;
         var type = LookupType ("System", name);
         type.etype = element_type;
         return reference = type;
     }
 }
Beispiel #25
0
 internal TypeSpecification(TypeReference type)
     : base(null, null)
 {
     this.element_type = type;
     this.token = new MetadataToken (TokenType.TypeSpec);
 }
Beispiel #26
0
 internal ParameterDefinition(TypeReference parameterType, IMethodSignature method)
     : this(string.Empty, ParameterAttributes.None, parameterType)
 {
     this.method = method;
 }
Beispiel #27
0
 public FieldDefinition(string name, FieldAttributes attributes, TypeReference fieldType)
     : base(name, fieldType)
 {
     this.attributes = (ushort) attributes;
 }
Beispiel #28
0
 public CustomAttributeArgument(TypeReference type, object value)
 {
     Mixin.CheckType (type);
     this.type = type;
     this.value = value;
 }
Beispiel #29
0
        public ArrayType(TypeReference type, int rank)
            : this(type)
        {
            Mixin.CheckType (type);

            if (rank == 1)
                return;

            dimensions = new Collection<ArrayDimension> (rank);
            for (int i = 0; i < rank; i++)
                dimensions.Add (new ArrayDimension ());
            this.etype = MD.ElementType.Array;
        }
Beispiel #30
0
 public EventDefinition(string name, EventAttributes attributes, TypeReference eventType)
     : base(name, eventType)
 {
     this.attributes = (ushort) attributes;
     this.token = new MetadataToken (TokenType.Event);
 }