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

Unified Diff: lib/compiler/implementation/scanner/parser.dart

Issue 10697096: Add "external" prefix to methods and constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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/parser.dart
diff --git a/lib/compiler/implementation/scanner/parser.dart b/lib/compiler/implementation/scanner/parser.dart
index dbe9c6ff7512186245112026fa292ef9334be101..ef4c5e341f9881c24046dbe74ebd421b5c6fa32c 100644
--- a/lib/compiler/implementation/scanner/parser.dart
+++ b/lib/compiler/implementation/scanner/parser.dart
@@ -467,7 +467,8 @@ class Parser {
('var' === token.stringValue) ||
('const' === token.stringValue) ||
('abstract' === token.stringValue) ||
- ('static' === token.stringValue));
+ ('static' === token.stringValue) ||
+ ('external' === token.stringValue));
listener.handleModifier(token);
return token.next;
}
@@ -480,7 +481,8 @@ class Parser {
('var' !== value) &&
('const' !== value) &&
('abstract' !== value) &&
- ('static' !== value))
+ ('static' !== value) &&
+ ('external' !== value))
break;
token = parseModifier(token);
count++;
@@ -567,7 +569,9 @@ class Parser {
}
Token parseMember(Token token) {
- if (optional('factory', token)) {
ahe 2012/08/02 20:14:36 This is kinda of a hack.
+ String value = token.stringValue;
+ if (value === 'factory' ||
+ (value === 'external' && optional('factory', token.next))) {
ahe 2012/08/02 20:14:36 And now the hack doesn't work anymore.
return parseFactoryMethod(token);
}
Token start = token;
@@ -631,7 +635,10 @@ class Parser {
}
Token parseFactoryMethod(Token token) {
- assert(optional('factory', token));
+ assert((optional('external', token) && optional('factory', token.next)) ||
+ optional('factory', token));
+ Token start = token;
+ if (start.stringValue === 'external') token = token.next;
Token factoryKeyword = token;
listener.beginFactoryMethod(factoryKeyword);
token = token.next; // Skip 'factory'.
@@ -645,7 +652,7 @@ class Parser {
}
token = parseFormalParameters(token);
token = parseFunctionBody(token, false);
- listener.endFactoryMethod(factoryKeyword, period, token);
+ listener.endFactoryMethod(factoryKeyword, period, start);
return token.next;
}

Powered by Google App Engine
This is Rietveld 408576698