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

Unified Diff: sdk/lib/_internal/compiler/implementation/typechecker.dart

Issue 15759011: Type check field initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Test added. Created 7 years, 7 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
Index: sdk/lib/_internal/compiler/implementation/typechecker.dart
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index cdd5f8c9efe38b334742d82d708d857a892a4e95..856eaa5f9d713770a0488d7a596d959ce161040c 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -335,16 +335,13 @@ class TypeCheckerVisitor extends Visitor<DartType> {
return currentClass.supertype;
} else {
Element element = elements[node];
- if (element != null) {
- assert(invariant(node, element.isVariable() || element.isParameter(),
- message: 'Unexpected context element ${element}'));
- return element.computeType(compiler);
- }
-
- assert(invariant(node, elements.currentElement.isField(),
- message: 'Unexpected context element ${elements.currentElement}'));
- // This is an identifier of a field declaration.
- return types.dynamicType;
+ assert(invariant(node, element != null,
+ message: 'Missing element for identifier'));
+ assert(invariant(node, element.isVariable() ||
+ element.isParameter() ||
+ element.isField(),
+ message: 'Unexpected context element ${element}'));
+ return element.computeType(compiler);
}
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/resolution/members.dart ('k') | tests/compiler/dart2js/patch_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698