34 CallingConventions callingConvention;
35 readonly Type propertyType;
36 readonly Type[] parameterTypes;
41 return new PropertySignature(callingConvention, propertyType,
Util.Copy(parameterTypes), customModifiers);
53 this.callingConvention = callingConvention;
54 this.propertyType = propertyType;
55 this.parameterTypes = parameterTypes;
56 this.customModifiers = customModifiers;
59 public override bool Equals(
object obj)
63 && other.propertyType.Equals(propertyType)
64 && other.customModifiers.Equals(customModifiers);
69 return propertyType.GetHashCode() ^ customModifiers.GetHashCode();
72 internal int ParameterCount
74 get {
return parameterTypes.Length; }
82 callingConvention |= CallingConventions.HasThis;
84 callingConvention &= ~CallingConventions.HasThis;
88 internal Type PropertyType
90 get {
return propertyType; }
93 internal CustomModifiers GetCustomModifiers()
95 return customModifiers.GetReturnTypeCustomModifiers();
100 return new PropertySignature(callingConvention, propertyType.BindTypeParameters(declaringType),
BindTypeParameters(declaringType, parameterTypes), customModifiers.Bind(declaringType));
103 internal override void Write(ModuleBuilder module,
ByteBuffer bb)
105 var flags = PROPERTY;
106 if ((callingConvention & CallingConventions.HasThis) != 0)
108 if ((callingConvention & CallingConventions.ExplicitThis) != 0)
109 flags |= EXPLICITTHIS;
110 if ((callingConvention & CallingConventions.VarArgs) != 0)
114 bb.WriteCompressedUInt(parameterTypes ==
null ? 0 : parameterTypes.Length);
118 if (parameterTypes !=
null)
120 for (var i = 0; i < parameterTypes.Length; i++)
123 WriteType(module, bb, parameterTypes[i]);
128 internal Type GetParameter(
int parameter)
130 return parameterTypes[parameter];
133 internal CustomModifiers GetParameterCustomModifiers(
int parameter)
135 return customModifiers.GetParameterCustomModifiers(parameter);
140 get {
return callingConvention; }
143 internal bool MatchParameterTypes(
Type[] types)
145 return Util.ArrayEquals(types, parameterTypes);
150 var flags = br.ReadByte();
151 if ((flags & PROPERTY) == 0)
152 throw new BadImageFormatException();
154 var callingConvention = CallingConventions.Standard;
155 if ((flags & HASTHIS) != 0)
156 callingConvention |= CallingConventions.HasThis;
157 if ((flags & EXPLICITTHIS) != 0)
158 callingConvention |= CallingConventions.ExplicitThis;
160 int paramCount = br.ReadCompressedUInt();
161 CustomModifiers[] mods =
null;
164 var parameterTypes =
new Type[paramCount];
165 for (
int i = 0; i < parameterTypes.Length; i++)
168 parameterTypes[i] =
ReadParam(module, br, context);