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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/tree/unparser.dart ('k') | tests/co19/co19-dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/tree_validator.dart
diff --git a/lib/compiler/implementation/tree_validator.dart b/lib/compiler/implementation/tree_validator.dart
index d25ff8611f943176a0681ef7804df759cbf25ca5..2601e0109ba9b945e55dee3ce38c31d57ed401bf 100644
--- a/lib/compiler/implementation/tree_validator.dart
+++ b/lib/compiler/implementation/tree_validator.dart
@@ -52,6 +52,14 @@ class ValidatorVisitor extends Visitor {
expect(node, !node.arguments.isEmpty());
}
}
+
+ visitReturn(Return node) {
+ if (!node.isRedirectingConstructorBody && node.hasExpression) {
+ // We allow non-expression expressions in Return nodes, but only when
+ // using them to hold redirecting factory constructors.
+ expect(node, node.expression.asExpression() != null);
+ }
+ }
}
class InvalidNodeError {
« 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