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

Unified Diff: src/preparser.cc

Issue 6606006: [Isolates] Merge 6500:6700 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 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 | « src/preparser.h ('k') | src/prettyprinter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.cc
===================================================================
--- src/preparser.cc (revision 7006)
+++ src/preparser.cc (working copy)
@@ -90,6 +90,7 @@
return ReportMessageAt(source_location.beg_pos, source_location.end_pos,
"unexpected_token_string", NULL);
case i::Token::IDENTIFIER:
+ case i::Token::FUTURE_RESERVED_WORD:
return ReportMessageAt(source_location.beg_pos, source_location.end_pos,
"unexpected_token_identifier", NULL);
default:
@@ -797,7 +798,7 @@
Expression result = kUnknownExpression;
if (peek() == i::Token::FUNCTION) {
Consume(i::Token::FUNCTION);
- if (peek() == i::Token::IDENTIFIER) {
+ if (peek_any_identifier()) {
ParseIdentifier(CHECK_OK);
}
result = ParseFunctionLiteral(CHECK_OK);
@@ -865,7 +866,8 @@
break;
}
- case i::Token::IDENTIFIER: {
+ case i::Token::IDENTIFIER:
+ case i::Token::FUTURE_RESERVED_WORD: {
ParseIdentifier(CHECK_OK);
result = kIdentifierExpression;
break;
@@ -953,7 +955,8 @@
while (peek() != i::Token::RBRACE) {
i::Token::Value next = peek();
switch (next) {
- case i::Token::IDENTIFIER: {
+ case i::Token::IDENTIFIER:
+ case i::Token::FUTURE_RESERVED_WORD: {
bool is_getter = false;
bool is_setter = false;
ParseIdentifierOrGetOrSet(&is_getter, &is_setter, CHECK_OK);
@@ -961,6 +964,7 @@
i::Token::Value name = Next();
bool is_keyword = i::Token::IsKeyword(name);
if (name != i::Token::IDENTIFIER &&
+ name != i::Token::FUTURE_RESERVED_WORD &&
name != i::Token::NUMBER &&
name != i::Token::STRING &&
!is_keyword) {
@@ -1158,7 +1162,9 @@
PreParser::Identifier PreParser::ParseIdentifier(bool* ok) {
- Expect(i::Token::IDENTIFIER, ok);
+ if (!Check(i::Token::FUTURE_RESERVED_WORD)) {
+ Expect(i::Token::IDENTIFIER, ok);
+ }
if (!*ok) return kUnknownIdentifier;
return GetIdentifierSymbol();
}
@@ -1173,7 +1179,8 @@
i::StrLength(keyword)));
return kUnknownExpression;
}
- if (next == i::Token::IDENTIFIER) {
+ if (next == i::Token::IDENTIFIER ||
+ next == i::Token::FUTURE_RESERVED_WORD) {
return GetIdentifierSymbol();
}
*ok = false;
@@ -1182,20 +1189,24 @@
// This function reads an identifier and determines whether or not it
-// is 'get' or 'set'. The reason for not using ParseIdentifier and
-// checking on the output is that this involves heap allocation which
-// we can't do during preparsing.
+// is 'get' or 'set'.
PreParser::Identifier PreParser::ParseIdentifierOrGetOrSet(bool* is_get,
bool* is_set,
bool* ok) {
- Expect(i::Token::IDENTIFIER, CHECK_OK);
+ PreParser::Identifier result = ParseIdentifier(CHECK_OK);
if (scanner_->is_literal_ascii() && scanner_->literal_length() == 3) {
const char* token = scanner_->literal_ascii_string().start();
*is_get = strncmp(token, "get", 3) == 0;
*is_set = !*is_get && strncmp(token, "set", 3) == 0;
}
- return GetIdentifierSymbol();
+ return result;
}
+bool PreParser::peek_any_identifier() {
+ i::Token::Value next = peek();
+ return next == i::Token::IDENTIFIER ||
+ next == i::Token::FUTURE_RESERVED_WORD;
+}
+
#undef CHECK_OK
} } // v8::preparser
« no previous file with comments | « src/preparser.h ('k') | src/prettyprinter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698