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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/tree_validator.dart

Issue 422483002: Mix in [TreeElementMixin] only on nodes that need it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 4 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 dart2js; 5 part of dart2js;
6 6
7 class TreeValidatorTask extends CompilerTask { 7 class TreeValidatorTask extends CompilerTask {
8 TreeValidatorTask(Compiler compiler) : super(compiler); 8 TreeValidatorTask(Compiler compiler) : super(compiler);
9 9
10 void validate(Node tree) { 10 void validate(Node tree) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 expect(node.arguments.tail.head, node.arguments.tail.isEmpty); 51 expect(node.arguments.tail.head, node.arguments.tail.isEmpty);
52 } else { 52 } else {
53 expect(node.arguments.head, node.arguments.isEmpty); 53 expect(node.arguments.head, node.arguments.isEmpty);
54 } 54 }
55 } else { 55 } else {
56 expect(node, !node.arguments.isEmpty); 56 expect(node, !node.arguments.isEmpty);
57 } 57 }
58 } 58 }
59 59
60 visitReturn(Return node) { 60 visitReturn(Return node) {
61 if (!node.isRedirectingFactoryBody && node.hasExpression) { 61 if (node.hasExpression) {
62 // We allow non-expression expressions in Return nodes, but only when 62 // We allow non-expression expressions in Return nodes, but only when
63 // using them to hold redirecting factory constructors. 63 // using them to hold redirecting factory constructors.
64 expect(node, node.expression.asExpression() != null); 64 expect(node, node.expression.asExpression() != null);
65 } 65 }
66 } 66 }
67 } 67 }
68 68
69 class InvalidNodeError { 69 class InvalidNodeError {
70 final Node node; 70 final Node node;
71 final String message; 71 final String message;
72 InvalidNodeError(this.node, [this.message]); 72 InvalidNodeError(this.node, [this.message]);
73 73
74 toString() { 74 toString() {
75 String nodeString = node.toDebugString(); 75 String nodeString = node.toDebugString();
76 String result = 'invalid node: $nodeString'; 76 String result = 'invalid node: $nodeString';
77 if (message != null) result = '$result ($message)'; 77 if (message != null) result = '$result ($message)';
78 return result; 78 return result;
79 } 79 }
80 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698