Author: marek
Date: 2007-09-25 11:13:10 -0400 (Tue, 25 Sep 2007)
New Revision: 86331
Modified:
trunk/mcs/mcs/ChangeLog
trunk/mcs/mcs/expression.cs
trunk/mcs/mcs/generic.cs
trunk/mcs/mcs/statement.cs
Log:
2007-09-25 Marek Safar <[EMAIL PROTECTED]>
* expression.cs (ArrayCreation): Fixed cloning of an implicit types.
* statement.cs (Block): Refactored AddVariable to allow error handling
customization.
* generic.cs: New stub.
Modified: trunk/mcs/mcs/ChangeLog
===================================================================
--- trunk/mcs/mcs/ChangeLog 2007-09-25 15:11:55 UTC (rev 86330)
+++ trunk/mcs/mcs/ChangeLog 2007-09-25 15:13:10 UTC (rev 86331)
@@ -1,3 +1,12 @@
+2007-09-25 Marek Safar <[EMAIL PROTECTED]>
+
+ * expression.cs (ArrayCreation): Fixed cloning of an implicit types.
+
+ * statement.cs (Block): Refactored AddVariable to allow error handling
+ customization.
+
+ * generic.cs: New stub.
+
2007-09-23 Marek Safar <[EMAIL PROTECTED]>
* anonymous.cs, codegen.cs: Changed InferReturnType to be EmitContext
Modified: trunk/mcs/mcs/expression.cs
===================================================================
--- trunk/mcs/mcs/expression.cs 2007-09-25 15:11:55 UTC (rev 86330)
+++ trunk/mcs/mcs/expression.cs 2007-09-25 15:13:10 UTC (rev 86331)
@@ -6099,7 +6099,8 @@
{
ArrayCreation target = (ArrayCreation) t;
- target.requested_base_type = requested_base_type.Clone
(clonectx);
+ if (requested_base_type != null)
+ target.requested_base_type =
requested_base_type.Clone (clonectx);
if (arguments != null){
target.arguments = new ArrayList
(arguments.Count);
Modified: trunk/mcs/mcs/generic.cs
===================================================================
--- trunk/mcs/mcs/generic.cs 2007-09-25 15:11:55 UTC (rev 86330)
+++ trunk/mcs/mcs/generic.cs 2007-09-25 15:13:10 UTC (rev 86331)
@@ -262,6 +262,10 @@
{
throw new NotImplementedException ();
}
+
+ internal static void Error_ParameterNameCollision (Location
loc, string name, string collisionWith)
+ {
+ }
public override MemberList FindMembers (MemberTypes mt,
BindingFlags bf,
MemberFilter filter,
object criteria)
Modified: trunk/mcs/mcs/statement.cs
===================================================================
--- trunk/mcs/mcs/statement.cs 2007-09-25 15:11:55 UTC (rev 86330)
+++ trunk/mcs/mcs/statement.cs 2007-09-25 15:13:10 UTC (rev 86331)
@@ -1767,8 +1767,7 @@
if (vi != null) {
Report.SymbolRelatedToPreviousError
(vi.Location, name);
if (Explicit == vi.Block.Explicit)
- Report.Error (128, l,
- "A local variable named `{0}'
is already defined in this scope", name);
+ Error_AlreadyDeclared (l, name, null);
else
Error_AlreadyDeclared (l, name,
"parent");
return null;
@@ -1779,7 +1778,18 @@
Report.SymbolRelatedToPreviousError
(pi.Location, name);
Error_AlreadyDeclared (loc, name,
pi.Block == Toplevel ? "method
argument" : "parent or current");
+ return null;
}
+
+ if (Toplevel.GenericMethod != null) {
+ foreach (TypeParameter tp in
Toplevel.GenericMethod.CurrentTypeParameters) {
+ if (tp.Name == name) {
+
Report.SymbolRelatedToPreviousError (tp);
+
Error_AlreadyDeclaredTypeParameter (loc, name);
+ return null;
+ }
+ }
+ }
IKnownVariable kvi = Explicit.GetKnownVariable (name);
if (kvi != null) {
@@ -1789,23 +1799,44 @@
}
vi = new LocalInfo (type, name, this, l);
- Variables.Add (name, vi);
- Explicit.AddKnownVariable (name, vi);
+ AddVariable (vi);
if ((flags & Flags.VariablesInitialized) != 0)
throw new InternalErrorException ("block has
already been resolved");
return vi;
}
+
+ protected virtual void AddVariable (LocalInfo li)
+ {
+ Variables.Add (li.Name, li);
+ Explicit.AddKnownVariable (li.Name, li);
+ }
- protected static void Error_AlreadyDeclared (Location loc,
string var, string reason)
+ protected virtual void Error_AlreadyDeclared (Location loc,
string var, string reason)
{
+ if (reason == null) {
+ Error_AlreadyDeclared (loc, var);
+ return;
+ }
+
Report.Error (136, loc, "A local variable named `{0}'
cannot be declared " +
"in this scope because it would give a
different meaning " +
"to `{0}', which is already used in a
`{1}' scope " +
"to denote something else", var, reason);
}
+ protected virtual void Error_AlreadyDeclared (Location loc,
string name)
+ {
+ Report.Error (128, loc,
+ "A local variable named `{0}' is already
defined in this scope", name);
+ }
+
+ protected virtual void Error_AlreadyDeclaredTypeParameter
(Location loc, string name)
+ {
+ GenericMethod.Error_ParameterNameCollision (loc, name,
"local variable");
+ }
+
public bool AddConstant (Expression type, string name,
Expression value, Location l)
{
if (AddVariable (type, name, l) == null)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches