+2005-03-25 Raja R Harinath <harinath@acm.org>
+
+ * enum.cs (Enum.DefineType): Set ec.InEnumContext and
+ ec.ContainerType.
+ (Enum.current_ec): Remove.
+ (Enum.LookupEnumValue): Remove EmitContext argument.
+ Just uses the one created during DefineType.
+ (Enum.FindMembers): Update.
+ * expression.cs (MemberAccess.DoResolve): Update.
+
2005-03-22 Marek Safar <marek.safar@seznam.cz>
* assign.cs (Assign.DoResolve): Check for CS1717 when
source and target are same (uses Equals).
-
+
* expression.cs (LocalVariableReference, ParameterReference,
This): Implemented Equals, GetHashCode.
-
+
* statement.cs (Block.GetParameterReference): Removed useless
local variable.
blocks before deciding whether the error is cs0136 or cs0128.
* cs-parser.jay: Pass MemberName to RootContext.Tree.RecordDecl.
- (using_alias_directive, using_namespace_directive): Pass
- MemberName, not an expression to Namespace.UsingAlias and
+ (using_alias_directive, using_namespace_directive): Pass
+ MemberName, not an expression to Namespace.UsingAlias and
Namespace.Using.
(MakeName): Use the MemberName of the namespace.
* namespace.cs (Namespace.MemberName): New.
(UsingEntry.UsingEntry): Take a MemberName, not an expression.
- (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
- Likewise.
+ (AliasEntry.AliasEntry, Namespace.Using, Namespace.UsingAlias):
+ Likewise.
* decl.cs (MemberName.Name): Make readonly.
(MemberName.FromDotted): New "constructor".
(MemberName.Equals, MemberName.GetHashCode): Implement overrides.
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.
or Conv.I depending on the source data type.
* cs-tokenizer.cs: Make the size for large decimal constants,
- fixes #72957.
+ fixes #72957.
2005-03-17 Martin Baulig <martin@ximian.com>
* delegate.cs (DelegateCreation.Error_NoMatchingMethodForDelegate):
Added CS0407.
-
+
* expression.cs (ParameterReference.IsAssigned): Changed error to
CS0269.
- (Error_WrongNumArguments): Moved CS0245 detection here.
-
+ (Error_WrongNumArguments): Moved CS0245 detection here.
+
* statement.cs (Return.Resolve): Add CS1622 report.
2005-03-11 Marek Safar <marek.safar@seznam.cz>
this.Type = expr;
}
- public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
+ public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
{
if (a.Type == TypeManager.marshal_as_attr_type) {
UnmanagedMarshal marshal = a.GetMarshal (this);
TypeAttributes attr = Modifiers.TypeAttr (ModFlags, IsTopLevel);
ec = new EmitContext (this, this, Location, null, null, ModFlags, false);
+ ec.InEnumContext = true;
attr |= TypeAttributes.Class | TypeAttributes.Sealed;
Basename, attr, TypeManager.enum_type);
}
+ ec.ContainerType = TypeBuilder;
+
//
// Call MapToInternalType for corlib
//
return false;
}
- //
- // Horrible, horrible. But there is no other way we can pass the EmitContext
- // to the recursive definition triggered by the evaluation of a forward
- // expression
- //
- static EmitContext current_ec = null;
-
/// <summary>
/// This is used to lookup the value of an enum member. If the member is undefined,
/// it attempts to define it and return its value
/// </summary>
- public object LookupEnumValue (EmitContext ec, string name, Location loc)
+ public object LookupEnumValue (string name, Location loc)
{
+ if (ec == null)
+ Report.Error (-1, loc, "Enum.LookupEnumValue () called too soon");
object default_value = null;
Constant c = null;
Location m_loc = (Mono.CSharp.Location)
member_to_location [n];
in_transit.Add (name, true);
-
- EmitContext old_ec = current_ec;
- current_ec = ec;
-
- default_value = LookupEnumValue (ec, n, m_loc);
-
- current_ec = old_ec;
-
+ default_value = LookupEnumValue (n, m_loc);
in_transit.Remove (name);
if (default_value == null)
return null;
}
} else {
- bool old = ec.InEnumContext;
- ec.InEnumContext = true;
- in_transit.Add (name, true);
+ if (!EmitContext.InEnumContext)
+ Report.Error (-1, loc, "foo");
- EmitContext old_ec = current_ec;
- current_ec = ec;
- val = val.Resolve (ec);
- current_ec = old_ec;
-
+ in_transit.Add (name, true);
+ val = val.Resolve (EmitContext);
in_transit.Remove (name);
- ec.InEnumContext = old;
if (val == null)
return null;
if (TypeBuilder == null)
return false;
- ec = new EmitContext (this, this, Location, null, UnderlyingType, ModFlags, false);
+ if (ec == null)
+ throw new InternalErrorException ("Enum.Define () called too soon");
object default_value = 0;
Location loc = (Mono.CSharp.Location) member_to_location [name];
if (this [name] != null) {
- default_value = LookupEnumValue (ec, name, loc);
+ default_value = LookupEnumValue (name, loc);
if (default_value == null)
return true;
ArrayList members = new ArrayList ();
if ((mt & MemberTypes.Field) != 0) {
- if (criteria is string){
- if (member_to_value [criteria] == null && current_ec != null){
- LookupEnumValue (current_ec, (string) criteria, Location.Null);
- }
+ if (criteria is string && member_to_value [criteria] == null) {
+ LookupEnumValue ((string) criteria, Location.Null);
}
foreach (FieldBuilder fb in field_builders)