Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(465)

Unified Diff: frog/gen.dart

Issue 8540023: Only set initializer fields as fields, not properties. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Looks like I fixed a test! Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frog/frogsh ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/gen.dart
diff --git a/frog/gen.dart b/frog/gen.dart
index a4e722cf127466315ddc5d22dd536a767abacc3e..e7fba972fbfc362003611a08ccd9647438371c18 100644
--- a/frog/gen.dart
+++ b/frog/gen.dart
@@ -847,10 +847,18 @@ class MethodGenerator implements TreeVisitor {
continue;
}
- initializedFields.add(left.name.name);
- var assign = _makeThisValue(null).set_(
- this, left.name.name, left.name, visitValue(init.y));
- writer.writeln('${assign.code};');
+ var f = method.declaringType.getMember(left.name.name);
+ if (f == null) {
+ world.error('bad initializer - no matching field', left.span);
+ continue;
+ } else if (!f.isField) {
+ world.error('"${left.name.name}" does not refer to a field',
+ left.span);
+ continue;
+ }
+
+ initializedFields.add(f.name);
+ writer.writeln('this.${f.jsname} = ${visitValue(init.y).code};');
} else {
world.error('invalid initializer', init.span);
}
« no previous file with comments | « frog/frogsh ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698