projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2005-07-06 Martin Baulig <martin@ximian.com>
[mono.git]
/
mcs
/
gmcs
/
assign.cs
diff --git
a/mcs/gmcs/assign.cs
b/mcs/gmcs/assign.cs
index 6c5c87d56eaf29f739501bbd4e7ddb50550d745c..b4b75fbfdfe91dad17e8acb2be42da73fefccfb4 100644
(file)
--- a/
mcs/gmcs/assign.cs
+++ b/
mcs/gmcs/assign.cs
@@
-313,8
+313,11
@@
namespace Mono.CSharp {
source = embedded = ((Assign) source).GetEmbeddedAssign (loc);
real_source = source = source.Resolve (ec);
source = embedded = ((Assign) source).GetEmbeddedAssign (loc);
real_source = source = source.Resolve (ec);
- if (source == null)
+ if (source == null) {
+ // Ensure that we don't propagate the error as spurious "uninitialized variable" errors.
+ target = target.ResolveLValue (ec, EmptyExpression.Null, Location);
return null;
return null;
+ }
//
// This is used in an embedded assignment.
//
// This is used in an embedded assignment.
@@
-345,11
+348,15
@@
namespace Mono.CSharp {
if (embedded != null)
source = (embedded.temp != null) ? embedded.temp : embedded.source;
if (embedded != null)
source = (embedded.temp != null) ? embedded.temp : embedded.source;
- target = target.ResolveLValue (ec, source);
+ target = target.ResolveLValue (ec, source
, Location
);
if (target == null)
return null;
if (target == null)
return null;
+ if (source.Equals (target)) {
+ Report.Warning (1717, 3, loc, "Assignment made to same variable; did you mean to assign something else?");
+ }
+
Type target_type = target.Type;
Type source_type = real_source.Type;
Type target_type = target.Type;
Type source_type = real_source.Type;
@@
-388,7
+395,7
@@
namespace Mono.CSharp {
}
FieldExpr field_exp = target as FieldExpr;
}
FieldExpr field_exp = target as FieldExpr;
- if (field_exp != null && !ec.IsConstructor && !ec.IsFieldInitializer) {
+ if (field_exp != null &&
field_exp.DeclaringType.IsValueType &&
!ec.IsConstructor && !ec.IsFieldInitializer) {
field_exp = field_exp.InstanceExpression as FieldExpr;
if (field_exp != null && field_exp.FieldInfo.IsInitOnly) {
if (field_exp.IsStatic) {
field_exp = field_exp.InstanceExpression as FieldExpr;
if (field_exp != null && field_exp.FieldInfo.IsInitOnly) {
if (field_exp.IsStatic) {