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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/resolution/members.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, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/typechecker.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of resolution; 5 part of resolution;
6 6
7 abstract class TreeElements { 7 abstract class TreeElements {
8 Element get currentElement; 8 Element get currentElement;
9 Set<Node> get superUses; 9 Set<Node> get superUses;
10 10
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 415 }
416 } 416 }
417 417
418 TreeElements resolveField(VariableElement element) { 418 TreeElements resolveField(VariableElement element) {
419 Node tree = element.parseNode(compiler); 419 Node tree = element.parseNode(compiler);
420 if(element.modifiers.isStatic() && element.variables.isTopLevel()) { 420 if(element.modifiers.isStatic() && element.variables.isTopLevel()) {
421 error(element.modifiers.getStatic(), 421 error(element.modifiers.getStatic(),
422 MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC); 422 MessageKind.TOP_LEVEL_VARIABLE_DECLARED_STATIC);
423 } 423 }
424 ResolverVisitor visitor = visitorFor(element); 424 ResolverVisitor visitor = visitorFor(element);
425 visitor.useElement(tree, element);
426
425 // TODO(johnniwinther): Avoid analyzing initializers if 427 // TODO(johnniwinther): Avoid analyzing initializers if
426 // [Compiler.analyzeSignaturesOnly] is set. 428 // [Compiler.analyzeSignaturesOnly] is set.
427 initializerDo(tree, visitor.visit); 429 initializerDo(tree, visitor.visit);
428 430
429 if (Elements.isStaticOrTopLevelField(element)) { 431 if (Elements.isStaticOrTopLevelField(element)) {
430 if (tree.asSendSet() != null) { 432 if (tree.asSendSet() != null) {
431 // TODO(ngeoffray): We could do better here by using the 433 // TODO(ngeoffray): We could do better here by using the
432 // constant handler to figure out if it's a lazy field or not. 434 // constant handler to figure out if it's a lazy field or not.
433 compiler.backend.registerLazyField(visitor.mapping); 435 compiler.backend.registerLazyField(visitor.mapping);
434 } else { 436 } else {
(...skipping 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after
4026 return e; 4028 return e;
4027 } 4029 }
4028 4030
4029 /// Assumed to be called by [resolveRedirectingFactory]. 4031 /// Assumed to be called by [resolveRedirectingFactory].
4030 Element visitReturn(Return node) { 4032 Element visitReturn(Return node) {
4031 Node expression = node.expression; 4033 Node expression = node.expression;
4032 return finishConstructorReference(visit(expression), 4034 return finishConstructorReference(visit(expression),
4033 expression, expression); 4035 expression, expression);
4034 } 4036 }
4035 } 4037 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698