Skip to content

Commit

Permalink
2005-03-18 Marek Safar <marek.safar@seznam.cz>
Browse files Browse the repository at this point in the history
	* modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
	property accessor modifiers.

	* class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
	fixed buffer attribute (CS1716).
	(PropertyMethod.HasCustomAccessModifier): When property accessor
	has custom modifier.
	
	* ecore (PropertyExpr.DoResolve): Add CS0271 for custom	accessor
	modifiers.
	(PropertyExpr.DoResolveLValue): Add CS0272.

svn path=/trunk/mcs/; revision=41979
  • Loading branch information
marek-safar committed Mar 18, 2005
1 parent c1b3e89 commit d8c1a70
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 3 deletions.
14 changes: 14 additions & 0 deletions mcs/mcs/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
2005-03-18 Marek Safar <marek.safar@seznam.cz>

* modifiers.cs (Modifiers.PROPERTY_CUSTOM): New constant for
property accessor modifiers.

* class.cs (FieldMember.ApplyAttributeBuilder): Don't allow apply
fixed buffer attribute (CS1716).
(PropertyMethod.HasCustomAccessModifier): When property accessor
has custom modifier.

* ecore (PropertyExpr.DoResolve): Add CS0271 for custom accessor
modifiers.
(PropertyExpr.DoResolveLValue): Add CS0272.

2005-03-17 Miguel de Icaza <miguel@novell.com>

* convert.cs: When converting to a pointer, use the proper Conv.U
Expand Down
18 changes: 17 additions & 1 deletion mcs/mcs/class.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5275,6 +5275,14 @@ public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder c
return;
}
}

#if NET_2_0
if (a.Type == TypeManager.fixed_buffer_attr_type) {
Report.Error (1716, Location, "Do not use 'System.Runtime.CompilerServices.FixedBuffer' attribute. Use the 'fixed' field modifier instead");
return;
}
#endif

base.ApplyAttributeBuilder (a, cb);
}

Expand Down Expand Up @@ -5410,7 +5418,7 @@ public override bool Define()
{
#if !NET_2_0
if ((ModFlags & (Modifiers.PUBLIC | Modifiers.PROTECTED)) != 0)
Report.Warning (-23, Location, "Only not private or internal fixed sized buffers are supported by .NET 1.x");
Report.Warning (-23, Location, "Only private or internal fixed sized buffers are supported by .NET 1.x");
#endif

if (Parent.Kind != Kind.Struct) {
Expand Down Expand Up @@ -5993,6 +6001,7 @@ public virtual MethodBuilder Define (TypeContainer container)
} else {
CheckModifiers (container, ModFlags);
ModFlags |= (method.ModFlags & (~Modifiers.Accessibility));
ModFlags |= Modifiers.PROPERTY_CUSTOM;
flags = Modifiers.MethodAttr (ModFlags);
flags |= (method.flags & (~MethodAttributes.MemberAccessMask));
}
Expand All @@ -6001,6 +6010,13 @@ public virtual MethodBuilder Define (TypeContainer container)

}

public bool HasCustomAccessModifier
{
get {
return (ModFlags & Modifiers.PROPERTY_CUSTOM) != 0;
}
}

public override Type[] ParameterTypes {
get {
return TypeManager.NoTypes;
Expand Down
20 changes: 18 additions & 2 deletions mcs/mcs/ecore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3235,7 +3235,15 @@ override public Expression DoResolve (EmitContext ec)

bool must_do_cs1540_check;
if (!IsAccessorAccessible (ec.ContainerType, getter, out must_do_cs1540_check)) {
Report.Error (122, loc, "'{0}.get' is inaccessible due to its protection level", PropertyInfo.Name);
PropertyBase.PropertyMethod pm = TypeManager.GetMethod (getter) as PropertyBase.PropertyMethod;
if (pm != null && pm.HasCustomAccessModifier) {
Report.SymbolRelatedToPreviousError (pm);
Report.Error (271, loc, "The property or indexer '{0}' cannot be used in this context because the get accessor is inaccessible",
TypeManager.CSharpSignature (getter));
}
else
Report.Error (122, loc, "'{0}' is inaccessible due to its protection level",
TypeManager.CSharpSignature (getter));
return null;
}

Expand Down Expand Up @@ -3287,7 +3295,15 @@ override public Expression DoResolveLValue (EmitContext ec, Expression right_sid

bool must_do_cs1540_check;
if (!IsAccessorAccessible (ec.ContainerType, setter, out must_do_cs1540_check)) {
Report.Error (122, loc, "'{0}.set' is inaccessible due to its protection level", PropertyInfo.Name);
PropertyBase.PropertyMethod pm = TypeManager.GetMethod (setter) as PropertyBase.PropertyMethod;
if (pm != null && pm.HasCustomAccessModifier) {
Report.SymbolRelatedToPreviousError (pm);
Report.Error (272, loc, "The property or indexer '{0}' cannot be used in this context because the set accessor is inaccessible",
TypeManager.CSharpSignature (setter));
}
else
Report.Error (122, loc, "'{0}' is inaccessible due to its protection level",
TypeManager.CSharpSignature (setter));
return null;
}

Expand Down
2 changes: 2 additions & 0 deletions mcs/mcs/modifiers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class Modifiers {
public const int UNSAFE = 0x2000;
public const int TOP = 0x2000;

public const int PROPERTY_CUSTOM = 0x4000; // Custom property modifier

//
// We use this internally to flag that the method contains an iterator
//
Expand Down

0 comments on commit d8c1a70

Please sign in to comment.