public Expression Initializer { get; private set; }
#endregion
+
+ public virtual FullNamedExpression GetFieldTypeExpression (FieldBase field)
+ {
+ return new TypeExpression (field.MemberType, Name.Location);
+ }
}
//
return fs;
}
- public override List<TypeSpec> ResolveMissingDependencies ()
+ public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
{
- return memberType.ResolveMissingDependencies ();
+ return memberType.ResolveMissingDependencies (this);
}
}
"`{0}': Fixed size buffers type must be one of the following: bool, byte, short, int, long, char, sbyte, ushort, uint, ulong, float or double",
GetSignatureForError ());
} else if (declarators != null) {
- var t = new TypeExpression (MemberType, TypeExpression.Location);
foreach (var d in declarators) {
- var f = new FixedField (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);
+ var f = new FixedField (Parent, d.GetFieldTypeExpression (this), ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);
f.initializer = d.Initializer;
((ConstInitializer) f.initializer).Name = d.Name.Value;
f.Define ();
FieldBuilder = Parent.TypeBuilder.DefineField (Name, fixed_buffer_type, ModifiersExtensions.FieldAttr (ModFlags));
var element_spec = new FieldSpec (null, this, MemberType, ffield, ModFlags);
- spec = new FixedFieldSpec (Parent.Definition, this, FieldBuilder, element_spec, ModFlags);
+ spec = new FixedFieldSpec (Module, Parent.Definition, this, FieldBuilder, element_spec, ModFlags);
Parent.MemberCache.AddMember (spec);
return true;
if (buffer_size > int.MaxValue / type_size) {
Report.Error (1664, Location, "Fixed size buffer `{0}' of length `{1}' and type `{2}' exceeded 2^31 limit",
- GetSignatureForError (), buffer_size.ToString (), TypeManager.CSharpName (MemberType));
+ GetSignatureForError (), buffer_size.ToString (), MemberType.GetSignatureForError ());
return;
}
{
readonly FieldSpec element;
- public FixedFieldSpec (TypeSpec declaringType, IMemberDefinition definition, FieldInfo info, FieldSpec element, Modifiers modifiers)
- : base (declaringType, definition, element.MemberType, info, modifiers)
+ public FixedFieldSpec (ModuleContainer module, TypeSpec declaringType, IMemberDefinition definition, FieldInfo info, FieldSpec element, Modifiers modifiers)
+ : base (declaringType, definition, PointerContainer.MakeType (module, element.MemberType), info, modifiers)
{
this.element = element;
return element;
}
}
-
+
public TypeSpec ElementType {
get {
- return MemberType;
+ return element.MemberType;
}
}
}
}
if (initializer != null) {
- Parent.RegisterFieldForInitialization (this,
- new FieldInitializer (spec, initializer, this));
+ Parent.RegisterFieldForInitialization (this, new FieldInitializer (this, initializer, TypeExpression.Location));
}
if (declarators != null) {
- var t = new TypeExpression (MemberType, TypeExpression.Location);
foreach (var d in declarators) {
- var f = new Field (Parent, t, ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);
+ var f = new Field (Parent, d.GetFieldTypeExpression (this), ModFlags, new MemberName (d.Name.Value, d.Name.Location), OptAttributes);
if (d.Initializer != null)
f.initializer = d.Initializer;
if ((ModFlags & Modifiers.VOLATILE) != 0) {
if (!CanBeVolatile ()) {
Report.Error (677, Location, "`{0}': A volatile field cannot be of the type `{1}'",
- GetSignatureForError (), TypeManager.CSharpName (MemberType));
+ GetSignatureForError (), MemberType.GetSignatureForError ());
}
if ((ModFlags & Modifiers.READONLY) != 0) {