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

Unified Diff: lib/src/checker/checker.dart

Issue 959003003: Typecheck constructor initializers properly (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 months 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 | « no previous file | test/checker/checker_test.dart » ('j') | test/checker/checker_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/checker/checker.dart
diff --git a/lib/src/checker/checker.dart b/lib/src/checker/checker.dart
index f11aef694ff1ac139d46db6066191c78d3d8860f..9af11723fd1185be526e08b1cb760d478c7ab944 100644
--- a/lib/src/checker/checker.dart
+++ b/lib/src/checker/checker.dart
@@ -373,10 +373,14 @@ class CodeChecker extends RecursiveAstVisitor {
node.visitChildren(this);
final init = node.initializers;
- for (int i = 0, last = init.length - 1; i < last; i++) {
+ for (int i = 0, last = init.length - 1; i <= last; i++) {
final node = init[i];
- if (node is SuperConstructorInvocation) {
+ if (i != last && node is SuperConstructorInvocation) {
_recordMessage(new InvalidSuperInvocation(node));
+ } else if (node is ConstructorFieldInitializer) {
+ var field = node.fieldName;
+ DartType staticType = _rules.elementType(field.staticElement);
+ node.expression = checkAssignment(node.expression, staticType);
}
Leaf 2015/02/26 22:00:16 A little surprising that this isn't in a separate
vsm 2015/02/26 23:55:47 Done.
}
}
« no previous file with comments | « no previous file | test/checker/checker_test.dart » ('j') | test/checker/checker_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698