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

Unified Diff: src/preparser.cc

Issue 561913002: Class syntax parsing (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: git rebase Created 6 years, 3 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.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index a60742aca9fe9a08d9ca33f76d4c2d75e1be4f80..3173cc0f900255aa1d764736d8c6f70d51da0ddb 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -78,6 +78,12 @@ PreParserIdentifier PreParserTraits::GetSymbol(Scanner* scanner) {
if (scanner->UnescapedLiteralMatches("arguments", 9)) {
return PreParserIdentifier::Arguments();
}
+ if (scanner->UnescapedLiteralMatches("prototype", 9)) {
+ return PreParserIdentifier::Prototype();
+ }
+ if (scanner->UnescapedLiteralMatches("constructor", 11)) {
+ return PreParserIdentifier::Constructor();
+ }
return PreParserIdentifier::Default();
}
@@ -178,6 +184,8 @@ PreParser::Statement PreParser::ParseSourceElement(bool* ok) {
switch (peek()) {
case Token::FUNCTION:
return ParseFunctionDeclaration(ok);
+ case Token::CLASS:
+ return ParseClassDeclaration(ok);
case Token::CONST:
return ParseVariableStatement(kSourceElement, ok);
case Token::LET:
@@ -305,6 +313,9 @@ PreParser::Statement PreParser::ParseStatement(bool* ok) {
}
}
+ case Token::CLASS:
+ return ParseClassDeclaration(CHECK_OK);
+
case Token::DEBUGGER:
return ParseDebuggerStatement(ok);
@@ -345,6 +356,18 @@ PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) {
}
+PreParser::Statement PreParser::ParseClassDeclaration(bool* ok) {
+ Expect(Token::CLASS, CHECK_OK);
+ int pos = position();
+ bool is_strict_reserved = false;
+ Identifier name =
+ ParseIdentifierOrStrictReservedWord(&is_strict_reserved, CHECK_OK);
+ ParseClassLiteral(name, scanner()->location(), is_strict_reserved, pos,
+ CHECK_OK);
+ return Statement::Default();
+}
+
+
PreParser::Statement PreParser::ParseBlock(bool* ok) {
// Block ::
// '{' Statement* '}'
« no previous file with comments | « src/preparser.h ('k') | src/prettyprinter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698