Author: martin
Date: 2005-07-08 08:59:09 -0400 (Fri, 08 Jul 2005)
New Revision: 47096
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/ecore.cs
trunk/mcs/gmcs/expression.cs
trunk/mcs/gmcs/statement.cs
Log:
**** Merged r46942 from MCS ****
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-07-08 12:58:36 UTC (rev 47095)
+++ trunk/mcs/gmcs/ChangeLog 2005-07-08 12:59:09 UTC (rev 47096)
@@ -1,3 +1,26 @@
+2005-07-05 Raja R Harinath <[EMAIL PROTECTED]>
+
+ Make 'fixed variable' handling standards compliant. Fix #70807, #72729.
+ * ecore.cs (IVariable.VerifyFixed): Remove 'is_expression' parameter.
+ (FieldExpr.VerifyFixed): Ensure that the field is part of a fixed
+ variable of struct type.
+ * expression.cs (Unary.ResolveOperator): Update to change.
+ (Indirection.VerifyFixed): Likewise.
+ (LocalVariableReference.VerifyFixed): A local variable is always fixed.
+ (ParameterReference.VerifyFixed): Value parameters are fixed.
+ (This.VerifyFixed): Treat 'this' as a value parameter.
+ * statement.cs (LocalInfo.IsFixed): Remove.
+
+2005-07-01 Martin Baulig <[EMAIL PROTECTED]>
+
+ * iterators.cs (Iterator.CapturedThisReference.Emit): Use
+ `ec.EmitThis ()' to get the correct scope.
+
+2005-07-01 Martin Baulig <[EMAIL PROTECTED]>
+
+ * ecore.cs (FieldExpr.DoResolve): Don't capture the field if it's
+ instance is a ParameterReference; fixes #75299.
+
2005-06-30 Raja R Harinath <[EMAIL PROTECTED]>
Fix #75412.
Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs 2005-07-08 12:58:36 UTC (rev 47095)
+++ trunk/mcs/gmcs/ecore.cs 2005-07-08 12:59:09 UTC (rev 47096)
@@ -115,7 +115,7 @@
get;
}
- bool VerifyFixed (bool is_expression);
+ bool VerifyFixed ();
}
/// <remarks>
@@ -3337,13 +3337,13 @@
}
}
- public bool VerifyFixed (bool is_expression)
+ public bool VerifyFixed ()
{
IVariable variable = InstanceExpression as IVariable;
- if ((variable == null) || !variable.VerifyFixed (true))
- return false;
-
- return true;
+ // A variable of the form V.I is fixed when V is a
fixed variable of a struct type.
+ // We defer the InstanceExpression check after the
variable check to avoid a
+ // separate null check on InstanceExpression.
+ return variable != null &&
InstanceExpression.Type.IsValueType && variable.VerifyFixed ();
}
public override int GetHashCode()
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2005-07-08 12:58:36 UTC (rev 47095)
+++ trunk/mcs/gmcs/expression.cs 2005-07-08 12:59:09 UTC (rev 47096)
@@ -432,7 +432,7 @@
}
IVariable variable = Expr as IVariable;
- bool is_fixed = variable != null &&
variable.VerifyFixed (false);
+ bool is_fixed = variable != null &&
variable.VerifyFixed ();
if (!ec.InFixedInitializer && !is_fixed) {
Error (212, "You can only take the
address of an unfixed expression inside " +
@@ -752,8 +752,9 @@
}
}
- public bool VerifyFixed (bool is_expression)
+ public bool VerifyFixed ()
{
+ // A pointer-indirection is always fixed.
return true;
}
@@ -3795,9 +3796,10 @@
return ret;
}
- public bool VerifyFixed (bool is_expression)
+ public bool VerifyFixed ()
{
- return !is_expression || local_info.IsFixed;
+ // A local Variable is always fixed.
+ return true;
}
public override int GetHashCode()
@@ -3951,9 +3953,10 @@
get { return vi; }
}
- public bool VerifyFixed (bool is_expression)
+ public bool VerifyFixed ()
{
- return !is_expression || TypeManager.IsValueType (type);
+ // A parameter is fixed if it's a value parameter
(i.e., no modifier like out, ref, param).
+ return mod == Parameter.Modifier.NONE;
}
public bool IsAssigned (EmitContext ec, Location loc)
@@ -7015,12 +7018,10 @@
get { return variable_info; }
}
- public bool VerifyFixed (bool is_expression)
+ public bool VerifyFixed ()
{
- if ((variable_info == null) || (variable_info.LocalInfo
== null))
- return false;
- else
- return variable_info.LocalInfo.IsFixed;
+ // Treat 'this' as a value parameter for the purpose of
fixed variable determination.
+ return true;
}
public bool ResolveBase (EmitContext ec)
Modified: trunk/mcs/gmcs/statement.cs
===================================================================
--- trunk/mcs/gmcs/statement.cs 2005-07-08 12:58:36 UTC (rev 47095)
+++ trunk/mcs/gmcs/statement.cs 2005-07-08 12:59:09 UTC (rev 47096)
@@ -1079,18 +1079,6 @@
return true;
}
- //
- // Whether the variable is Fixed (because its Pinned or its a
value type)
- //
- public bool IsFixed {
- get {
- if (((flags & Flags.Pinned) != 0) ||
TypeManager.IsValueType (VariableType))
- return true;
-
- return false;
- }
- }
-
public bool IsCaptured {
get {
return (flags & Flags.Captured) != 0;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches