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

Unified Diff: sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart

Issue 675113002: Support async/await in the dart2js frontend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update unittests Created 6 years, 1 month 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: sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart b/sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart
index 98fc1ab3bf7344b2aece1bf2f08e7c0692f959b5..b2bce8316d42945b9941782be5914e8bf1de1868 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/partial_parser.dart
@@ -103,8 +103,29 @@ class PartialParser extends Parser {
return endGroup;
}
+ Token skipAsyncModifier(Token token) {
+ String value = token.stringValue;
+ if (identical(value, 'async')) {
+ token = token.next;
+ value = token.stringValue;
+
+ if (identical(value, '*')) {
+ token = token.next;
+ }
+ } else if (identical(value, 'sync')) {
+ token = token.next;
+ value = token.stringValue;
+
+ if (identical(value, '*')) {
+ token = token.next;
+ }
+ }
+ return token;
+ }
+
Token parseFunctionBody(Token token, bool isExpression, bool allowAbstract) {
assert(!isExpression);
+ token = skipAsyncModifier(token);
String value = token.stringValue;
if (identical(value, ';')) {
if (!allowAbstract) {
@@ -112,14 +133,16 @@ class PartialParser extends Parser {
}
listener.handleNoFunctionBody(token);
} else {
- if (identical(value, '=>')) {
- token = parseExpression(token.next);
- expectSemicolon(token);
- } else if (value == '=') {
+ if (value == '=') {
token = parseRedirectingFactoryBody(token);
expectSemicolon(token);
} else {
- token = skipBlock(token);
+ if (identical(value, '=>')) {
floitsch 2014/11/03 17:55:54 I prefer the 'else if' indentation. Why this chan
Johnni Winther 2014/11/04 12:24:33 Done.
+ token = parseExpression(token.next);
+ expectSemicolon(token);
+ } else {
+ token = skipBlock(token);
+ }
}
listener.skippedFunctionBody(token);
}

Powered by Google App Engine
This is Rietveld 408576698