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

Unified Diff: lib/compiler/implementation/scanner/listener.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. 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
Index: lib/compiler/implementation/scanner/listener.dart
diff --git a/lib/compiler/implementation/scanner/listener.dart b/lib/compiler/implementation/scanner/listener.dart
index 2017961c5a8ed5f4ebd4e522d21fd37284dceb12..b1c217a4b948d269ea553d49862e56fc11f2161a 100644
--- a/lib/compiler/implementation/scanner/listener.dart
+++ b/lib/compiler/implementation/scanner/listener.dart
@@ -268,6 +268,18 @@ class Listener {
void endPartOf(Token partKeyword, Token semicolon) {
}
+ void beginQualifiedList(Token start) {
+ }
+
+ void endQualifiedList(int count) {
+ }
+
+ void beginRedirectingFactoryBody(Token token) {
+ }
+
+ void endRedirectingFactoryBody(Token beginToken, Token endToken) {
+ }
+
void beginReturnStatement(Token token) {
}
@@ -1207,6 +1219,16 @@ class NodeListener extends ElementListener {
pushNode(null);
}
+ void endQualifiedList(int count) {
+ pushNode(makeNodeList(count, null, null, "."));
+ }
+
+ void endRedirectingFactoryBody(Token beginToken,
+ Token endToken) {
+ NodeList qualifiedList = popNode();
+ pushNode(new Return(beginToken, endToken, qualifiedList));
+ }
+
void endReturnStatement(bool hasExpression,
Token beginToken, Token endToken) {
Expression expression = hasExpression ? popNode() : null;
@@ -1634,13 +1656,16 @@ class NodeListener extends ElementListener {
// A library prefix was handled in [handleQualified].
name = new Send(popNode(), name);
}
- handleModifier(startKeyword);
- if (startKeyword.stringValue === 'external') {
- handleModifier(startKeyword.next);
- handleModifiers(2);
- } else {
- handleModifiers(1);
+ int modifierCount = 0;
+ Token modifier = startKeyword;
+ for (;;) {
ahe 2012/10/09 10:51:37 Could you unfold this loop so we can easily see th
Lasse Reichstein Nielsen 2012/10/09 11:51:26 Done.
+ // Handle 'external' and 'const' occuring before 'factory'.
+ handleModifier(modifier);
+ modifierCount++;
+ if (modifier.stringValue === 'factory') break;
+ modifier = modifier.next;
}
+ handleModifiers(modifierCount);
Modifiers modifiers = popNode();
pushNode(new FunctionExpression(name, formals, body, null,
modifiers, null, null));

Powered by Google App Engine
This is Rietveld 408576698