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

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. 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/resolver.dart ('k') | lib/compiler/implementation/scanner/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6c5d3cda05184f6a5cdb5bdda57fc0cce871e5ab 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,14 +1656,25 @@ 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);
+ // TODO(ahe): Move this parsing to the parser.
+ int modifierCount = 0;
+ Token modifier = startKeyword;
+ if (modifier.stringValue == "external") {
+ handleModifier(modifier);
+ modifierCount++;
+ modifier = modifier.next;
+ }
+ if (modifier.stringValue == "const") {
+ handleModifier(modifier);
+ modifierCount++;
+ modifier = modifier.next;
}
+ assert(modifier.stringValue == "factory");
+ handleModifier(modifier);
+ modifierCount++;
+ handleModifiers(modifierCount);
Modifiers modifiers = popNode();
+
pushNode(new FunctionExpression(name, formals, body, null,
modifiers, null, null));
}
« no previous file with comments | « lib/compiler/implementation/resolver.dart ('k') | lib/compiler/implementation/scanner/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698