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

Unified Diff: src/preparser.cc

Issue 1399893002: [es7] implement |do| expressions proposal (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Less code duplication in Rewriter Created 5 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: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index ecf4a950c0ea8e76192e205020de4713bafb5f40..74e11b1d454b3b33a3f6bcadb18f91476a246f37 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -1239,6 +1239,23 @@ PreParser::Expression PreParser::ParseV8Intrinsic(bool* ok) {
return Expression::Default();
}
+
+PreParserExpression PreParser::ParseDoExpression(bool* ok) {
+ // AssignmentExpression ::
+ // do '{' StatementList '}'
+ Expect(Token::DO, CHECK_OK);
+ Expect(Token::LBRACE, CHECK_OK);
+ Scope* block_scope = NewScope(scope_, BLOCK_SCOPE);
adamk 2015/10/15 10:59:33 Why does this need a Scope when we don't use a Sco
caitp (gmail) 2015/10/15 11:24:17 Allocating the temporary result, but it lives in t
adamk 2015/10/15 12:01:25 I'd remove it (and maybe just delegate to ParseBlo
caitp (gmail) 2015/10/15 12:34:07 Wait, I had actually gotten rid of this in an earl
+ {
+ BlockState block_state(&scope_, block_scope);
+ while (peek() != Token::RBRACE) {
+ ParseStatementListItem(CHECK_OK);
+ }
+ Expect(Token::RBRACE, CHECK_OK);
+ return PreParserExpression::Default();
+ }
+}
+
#undef CHECK_OK

Powered by Google App Engine
This is Rietveld 408576698