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

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

Issue 10957060: First stab at parsing redirecting constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Add test exceptions. Created 8 years, 2 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 | « lib/compiler/implementation/tree/unparser.dart ('k') | tests/co19/co19-dart2js.status » ('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) 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 class TreeValidatorTask extends CompilerTask { 5 class TreeValidatorTask extends CompilerTask {
6 TreeValidatorTask(Compiler compiler) : super(compiler); 6 TreeValidatorTask(Compiler compiler) : super(compiler);
7 7
8 void validate(Node tree) { 8 void validate(Node tree) {
9 assert(check(tree)); 9 assert(check(tree));
10 } 10 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 expect(node, node.assignmentOperator is Operator); 45 expect(node, node.assignmentOperator is Operator);
46 if (node.isIndex) { 46 if (node.isIndex) {
47 expect(node.arguments.tail.head, node.arguments.tail.isEmpty()); 47 expect(node.arguments.tail.head, node.arguments.tail.isEmpty());
48 } else { 48 } else {
49 expect(node.arguments.head, node.arguments.isEmpty()); 49 expect(node.arguments.head, node.arguments.isEmpty());
50 } 50 }
51 } else { 51 } else {
52 expect(node, !node.arguments.isEmpty()); 52 expect(node, !node.arguments.isEmpty());
53 } 53 }
54 } 54 }
55
56 visitReturn(Return node) {
57 if (!node.isRedirectingConstructorBody && node.hasExpression) {
58 // We allow non-expression expressions in Return nodes, but only when
59 // using them to hold redirecting factory constructors.
60 expect(node, node.expression.asExpression() != null);
61 }
62 }
55 } 63 }
56 64
57 class InvalidNodeError { 65 class InvalidNodeError {
58 final Node node; 66 final Node node;
59 final String message; 67 final String message;
60 InvalidNodeError(this.node, [this.message]); 68 InvalidNodeError(this.node, [this.message]);
61 69
62 toString() { 70 toString() {
63 String nodeString = node.toDebugString(); 71 String nodeString = node.toDebugString();
64 String result = 'invalid node: $nodeString'; 72 String result = 'invalid node: $nodeString';
65 if (message !== null) result = '$result ($message)'; 73 if (message !== null) result = '$result ($message)';
66 return result; 74 return result;
67 } 75 }
68 } 76 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/tree/unparser.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698