Author: martin
Date: 2005-03-21 07:35:00 -0500 (Mon, 21 Mar 2005)
New Revision: 42046
Modified:
trunk/mcs/gmcs/ChangeLog
trunk/mcs/gmcs/ecore.cs
trunk/mcs/gmcs/expression.cs
Log:
**** Merged r39544-r39626 from MCS ****
Modified: trunk/mcs/gmcs/ChangeLog
===================================================================
--- trunk/mcs/gmcs/ChangeLog 2005-03-21 11:21:50 UTC (rev 42045)
+++ trunk/mcs/gmcs/ChangeLog 2005-03-21 12:35:00 UTC (rev 42046)
@@ -1,3 +1,22 @@
+2005-01-27 Marek Safar <[EMAIL PROTECTED]>
+
+ * expression.cs (Indirection): Implemented IVariable interface
+ to support indirection in AddressOf operator.
+ (PointerArithmetic.Emit): Add optimalization for case where
+ result can be precomputed.
+
+2005-01-26 Martin Baulig <[EMAIL PROTECTED]>
+
+ * class.cs (TypeContainer.AttributeTargets): Return the correct
+ AttributeTargets depending on our `Kind' instead of throwing an
+ exception; fixes #71632.
+
+2005-01-26 Marek Safar <[EMAIL PROTECTED]>
+
+ Fix #71257
+ * expression.cs (MemberAccess.ResolveMemberAccess): Add CS0176 test for
+ constant members.
+
2005-03-17 Martin Baulig <[EMAIL PROTECTED]>
* anonymous.cs (AnonymousMethod.method_modifiers): Change default
Modified: trunk/mcs/gmcs/ecore.cs
===================================================================
--- trunk/mcs/gmcs/ecore.cs 2005-03-21 11:21:50 UTC (rev 42045)
+++ trunk/mcs/gmcs/ecore.cs 2005-03-21 12:35:00 UTC (rev 42046)
@@ -944,7 +944,7 @@
sb.Append (valid [i]);
}
- Error (119, "Expression denotes a `" + ExprClassName ()
+ "' where " +
+ Report.Error (119, loc, "Expression denotes a `" +
ExprClassName () + "' where " +
"a `" + sb.ToString () + "' was expected");
}
Modified: trunk/mcs/gmcs/expression.cs
===================================================================
--- trunk/mcs/gmcs/expression.cs 2005-03-21 11:21:50 UTC (rev 42045)
+++ trunk/mcs/gmcs/expression.cs 2005-03-21 12:35:00 UTC (rev 42046)
@@ -431,13 +431,15 @@
}
IVariable variable = Expr as IVariable;
- if (!ec.InFixedInitializer && ((variable ==
null) || !variable.VerifyFixed (false))) {
+ bool is_fixed = variable != null &&
variable.VerifyFixed (false);
+
+ if (!ec.InFixedInitializer && !is_fixed) {
Error (212, "You can only take the
address of an unfixed expression inside " +
"of a fixed statement
initializer");
return null;
}
- if (ec.InFixedInitializer && ((variable !=
null) && variable.VerifyFixed (false))) {
+ if (ec.InFixedInitializer && is_fixed) {
Error (213, "You can not fix an already
fixed expression");
return null;
}
@@ -661,7 +663,7 @@
// after semantic analysis (this is so we can take the address
// of an indirection).
//
- public class Indirection : Expression, IMemoryLocation, IAssignMethod {
+ public class Indirection : Expression, IMemoryLocation, IAssignMethod,
IVariable {
Expression expr;
LocalTemporary temporary;
bool prepared;
@@ -735,6 +737,21 @@
{
return "*(" + expr + ")";
}
+
+ #region IVariable Members
+
+ public VariableInfo VariableInfo {
+ get {
+ return null;
+ }
+ }
+
+ public bool VerifyFixed (bool is_expression)
+ {
+ return true;
+ }
+
+ #endregion
}
/// <summary>
@@ -3458,17 +3475,26 @@
//
left.Emit (ec);
ig.Emit (OpCodes.Conv_I);
- right.Emit (ec);
- if (size != 1){
- if (size == 0)
- ig.Emit (OpCodes.Sizeof,
element);
- else
- IntLiteral.EmitInt (ig, size);
- if (rtype == TypeManager.int64_type)
- ig.Emit (OpCodes.Conv_I8);
- else if (rtype ==
TypeManager.uint64_type)
- ig.Emit (OpCodes.Conv_U8);
- ig.Emit (OpCodes.Mul);
+
+ Constant right_const = right as Constant;
+ if (right_const != null && size != 0) {
+ Expression ex = ConstantFold.BinaryFold
(ec, Binary.Operator.Multiply, new IntConstant (size), right_const, loc);
+ if (ex == null)
+ return;
+ ex.Emit (ec);
+ } else {
+ right.Emit (ec);
+ if (size != 1){
+ if (size == 0)
+ ig.Emit
(OpCodes.Sizeof, element);
+ else
+ IntLiteral.EmitInt (ig,
size);
+ if (rtype ==
TypeManager.int64_type)
+ ig.Emit
(OpCodes.Conv_I8);
+ else if (rtype ==
TypeManager.uint64_type)
+ ig.Emit
(OpCodes.Conv_U8);
+ ig.Emit (OpCodes.Mul);
+ }
}
if (rtype == TypeManager.int64_type || rtype ==
TypeManager.uint64_type)
@@ -7283,7 +7309,15 @@
object real_value = ((Constant)
c.Expr).GetValue ();
- return Constantify (real_value,
t);
+ Expression exp = Constantify
(real_value, t);
+
+ if (left_is_explicit &&
!left_is_type && !IdenticalNameAndTypeName (ec, left_original, left, loc)) {
+
Report.SymbolRelatedToPreviousError (c);
+ error176 (loc,
c.GetSignatureForError ());
+ return null;
+ }
+
+ return exp;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches