Chromium Code Reviews| Index: src/preparser.cc |
| diff --git a/src/preparser.cc b/src/preparser.cc |
| index 2f329764600427e0fc52e3bc223ec031af7097f1..e449880d8d4e4fc7f94a1a1d680893beab2f6d82 100644 |
| --- a/src/preparser.cc |
| +++ b/src/preparser.cc |
| @@ -183,7 +183,7 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction( |
| #undef DUMMY |
| -PreParser::Statement PreParser::ParseSourceElement(bool* ok) { |
| +PreParserStatement PreParser::ParseSourceElement(bool* ok) { |
|
marja
2014/04/24 15:31:10
The same here.
|
| // (Ecma 262 5th Edition, clause 14): |
| // SourceElement: |
| // Statement |
| @@ -217,7 +217,7 @@ PreParser::SourceElements PreParser::ParseSourceElements(int end_token, |
| if (directive_prologue && peek() != Token::STRING) { |
| directive_prologue = false; |
| } |
| - Statement statement = ParseSourceElement(CHECK_OK); |
| + PreParserStatement statement = ParseSourceElement(CHECK_OK); |
|
marja
2014/04/24 15:31:10
... and overall.
|
| if (directive_prologue) { |
| if (statement.IsUseStrictLiteral()) { |
| scope_->SetStrictMode(STRICT); |
| @@ -231,14 +231,14 @@ PreParser::SourceElements PreParser::ParseSourceElements(int end_token, |
| #undef CHECK_OK |
| -#define CHECK_OK ok); \ |
| - if (!*ok) return Statement::Default(); \ |
| +#define CHECK_OK ok); \ |
| + if (!*ok) return PreParserStatement::Default(); \ |
| ((void)0 |
| #define DUMMY ) // to make indentation work |
| #undef DUMMY |
| -PreParser::Statement PreParser::ParseStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseStatement(bool* ok) { |
| // Statement :: |
| // Block |
| // VariableStatement |
| @@ -275,7 +275,7 @@ PreParser::Statement PreParser::ParseStatement(bool* ok) { |
| case Token::SEMICOLON: |
| Next(); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| case Token::IF: |
| return ParseIfStatement(ok); |
| @@ -312,7 +312,7 @@ PreParser::Statement PreParser::ParseStatement(bool* ok) { |
| case Token::FUNCTION: { |
| Scanner::Location start_location = scanner()->peek_location(); |
| - Statement statement = ParseFunctionDeclaration(CHECK_OK); |
| + PreParserStatement statement = ParseFunctionDeclaration(CHECK_OK); |
| Scanner::Location end_location = scanner()->location(); |
| if (strict_mode() == STRICT) { |
| PreParserTraits::ReportMessageAt(start_location.beg_pos, |
| @@ -320,7 +320,7 @@ PreParser::Statement PreParser::ParseStatement(bool* ok) { |
| "strict_function", |
| NULL); |
| *ok = false; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } else { |
| return statement; |
| } |
| @@ -335,7 +335,7 @@ PreParser::Statement PreParser::ParseStatement(bool* ok) { |
| } |
| -PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) { |
| +PreParserStatement PreParser::ParseFunctionDeclaration(bool* ok) { |
| // FunctionDeclaration :: |
| // 'function' Identifier '(' FormalParameterListopt ')' '{' FunctionBody '}' |
| // GeneratorDeclaration :: |
| @@ -354,11 +354,11 @@ PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) { |
| pos, |
| FunctionLiteral::DECLARATION, |
| CHECK_OK); |
| - return Statement::FunctionDeclaration(); |
| + return PreParserStatement::FunctionDeclaration(); |
| } |
| -PreParser::Statement PreParser::ParseBlock(bool* ok) { |
| +PreParserStatement PreParser::ParseBlock(bool* ok) { |
| // Block :: |
| // '{' Statement* '}' |
| @@ -374,20 +374,20 @@ PreParser::Statement PreParser::ParseBlock(bool* ok) { |
| } |
| } |
| Expect(Token::RBRACE, ok); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseVariableStatement( |
| +PreParserStatement PreParser::ParseVariableStatement( |
| VariableDeclarationContext var_context, |
| bool* ok) { |
| // VariableStatement :: |
| // VariableDeclarations ';' |
| - Statement result = ParseVariableDeclarations(var_context, |
| - NULL, |
| - NULL, |
| - CHECK_OK); |
| + PreParserStatement result = ParseVariableDeclarations(var_context, |
| + NULL, |
| + NULL, |
| + CHECK_OK); |
| ExpectSemicolon(CHECK_OK); |
| return result; |
| } |
| @@ -398,7 +398,7 @@ PreParser::Statement PreParser::ParseVariableStatement( |
| // *var is untouched; in particular, it is the caller's responsibility |
| // to initialize it properly. This mechanism is also used for the parsing |
| // of 'for-in' loops. |
| -PreParser::Statement PreParser::ParseVariableDeclarations( |
| +PreParserStatement PreParser::ParseVariableDeclarations( |
| VariableDeclarationContext var_context, |
| VariableDeclarationProperties* decl_props, |
| int* num_decl, |
| @@ -436,14 +436,14 @@ PreParser::Statement PreParser::ParseVariableDeclarations( |
| if (var_context != kSourceElement && var_context != kForStatement) { |
| ReportMessageAt(scanner()->peek_location(), "unprotected_const"); |
| *ok = false; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| require_initializer = true; |
| } else { |
| Scanner::Location location = scanner()->peek_location(); |
| ReportMessageAt(location, "strict_const"); |
| *ok = false; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| } |
| } else if (peek() == Token::LET) { |
| @@ -458,18 +458,18 @@ PreParser::Statement PreParser::ParseVariableDeclarations( |
| if (!allow_harmony_scoping() || strict_mode() == SLOPPY) { |
| ReportMessageAt(scanner()->peek_location(), "illegal_let"); |
| *ok = false; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| Consume(Token::LET); |
| if (var_context != kSourceElement && |
| var_context != kForStatement) { |
| ReportMessageAt(scanner()->peek_location(), "unprotected_let"); |
| *ok = false; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| } else { |
| *ok = false; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| // The scope of a var/const declared variable anywhere inside a function |
| @@ -490,11 +490,11 @@ PreParser::Statement PreParser::ParseVariableDeclarations( |
| } while (peek() == Token::COMMA); |
| if (num_decl != NULL) *num_decl = nvars; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseExpressionOrLabelledStatement(bool* ok) { |
| // ExpressionStatement | LabelledStatement :: |
| // Expression ';' |
| // Identifier ':' Statement |
| @@ -519,11 +519,11 @@ PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(bool* ok) { |
| } |
| // Parsed expression statement. |
| ExpectSemicolon(CHECK_OK); |
| - return Statement::ExpressionStatement(expr); |
| + return PreParserStatement::ExpressionStatement(expr); |
| } |
| -PreParser::Statement PreParser::ParseIfStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseIfStatement(bool* ok) { |
| // IfStatement :: |
| // 'if' '(' Expression ')' Statement ('else' Statement)? |
| @@ -536,11 +536,11 @@ PreParser::Statement PreParser::ParseIfStatement(bool* ok) { |
| Next(); |
| ParseStatement(CHECK_OK); |
| } |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseContinueStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseContinueStatement(bool* ok) { |
| // ContinueStatement :: |
| // 'continue' [no line terminator] Identifier? ';' |
| @@ -554,11 +554,11 @@ PreParser::Statement PreParser::ParseContinueStatement(bool* ok) { |
| ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); |
| } |
| ExpectSemicolon(CHECK_OK); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseBreakStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseBreakStatement(bool* ok) { |
| // BreakStatement :: |
| // 'break' [no line terminator] Identifier? ';' |
| @@ -572,11 +572,11 @@ PreParser::Statement PreParser::ParseBreakStatement(bool* ok) { |
| ParseIdentifier(kAllowEvalOrArguments, CHECK_OK); |
| } |
| ExpectSemicolon(CHECK_OK); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseReturnStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseReturnStatement(bool* ok) { |
| // ReturnStatement :: |
| // 'return' [no line terminator] Expression? ';' |
| @@ -598,18 +598,18 @@ PreParser::Statement PreParser::ParseReturnStatement(bool* ok) { |
| ParseExpression(true, CHECK_OK); |
| } |
| ExpectSemicolon(CHECK_OK); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseWithStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseWithStatement(bool* ok) { |
| // WithStatement :: |
| // 'with' '(' Expression ')' Statement |
| Expect(Token::WITH, CHECK_OK); |
| if (strict_mode() == STRICT) { |
| ReportMessageAt(scanner()->location(), "strict_mode_with"); |
| *ok = false; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| Expect(Token::LPAREN, CHECK_OK); |
| ParseExpression(true, CHECK_OK); |
| @@ -618,11 +618,11 @@ PreParser::Statement PreParser::ParseWithStatement(bool* ok) { |
| PreParserScope with_scope(scope_, WITH_SCOPE); |
| BlockState block_state(&scope_, &with_scope); |
| ParseStatement(CHECK_OK); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseSwitchStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseSwitchStatement(bool* ok) { |
| // SwitchStatement :: |
| // 'switch' '(' Expression ')' '{' CaseClause* '}' |
| @@ -650,11 +650,11 @@ PreParser::Statement PreParser::ParseSwitchStatement(bool* ok) { |
| } |
| } |
| Expect(Token::RBRACE, ok); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseDoWhileStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseDoWhileStatement(bool* ok) { |
| // DoStatement :: |
| // 'do' Statement 'while' '(' Expression ')' ';' |
| @@ -665,11 +665,11 @@ PreParser::Statement PreParser::ParseDoWhileStatement(bool* ok) { |
| ParseExpression(true, CHECK_OK); |
| Expect(Token::RPAREN, ok); |
| if (peek() == Token::SEMICOLON) Consume(Token::SEMICOLON); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseWhileStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseWhileStatement(bool* ok) { |
| // WhileStatement :: |
| // 'while' '(' Expression ')' Statement |
| @@ -678,7 +678,7 @@ PreParser::Statement PreParser::ParseWhileStatement(bool* ok) { |
| ParseExpression(true, CHECK_OK); |
| Expect(Token::RPAREN, CHECK_OK); |
| ParseStatement(ok); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| @@ -692,7 +692,7 @@ bool PreParser::CheckInOrOf(bool accept_OF) { |
| } |
| -PreParser::Statement PreParser::ParseForStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseForStatement(bool* ok) { |
| // ForStatement :: |
| // 'for' '(' Expression? ';' Expression? ';' Expression? ')' Statement |
| @@ -714,7 +714,7 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) { |
| Expect(Token::RPAREN, CHECK_OK); |
| ParseStatement(CHECK_OK); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| } else { |
| Expression lhs = ParseExpression(false, CHECK_OK); |
| @@ -723,7 +723,7 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) { |
| Expect(Token::RPAREN, CHECK_OK); |
| ParseStatement(CHECK_OK); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| } |
| } |
| @@ -742,11 +742,11 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) { |
| Expect(Token::RPAREN, CHECK_OK); |
| ParseStatement(ok); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseThrowStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseThrowStatement(bool* ok) { |
| // ThrowStatement :: |
| // 'throw' [no line terminator] Expression ';' |
| @@ -754,15 +754,15 @@ PreParser::Statement PreParser::ParseThrowStatement(bool* ok) { |
| if (scanner()->HasAnyLineTerminatorBeforeNext()) { |
| ReportMessageAt(scanner()->location(), "newline_after_throw"); |
| *ok = false; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| ParseExpression(true, CHECK_OK); |
| ExpectSemicolon(ok); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseTryStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseTryStatement(bool* ok) { |
| // TryStatement :: |
| // 'try' Block Catch |
| // 'try' Block Finally |
| @@ -782,7 +782,7 @@ PreParser::Statement PreParser::ParseTryStatement(bool* ok) { |
| if (tok != Token::CATCH && tok != Token::FINALLY) { |
| ReportMessageAt(scanner()->location(), "no_catch_or_finally"); |
| *ok = false; |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| if (tok == Token::CATCH) { |
| Consume(Token::CATCH); |
| @@ -800,11 +800,11 @@ PreParser::Statement PreParser::ParseTryStatement(bool* ok) { |
| Consume(Token::FINALLY); |
| ParseBlock(CHECK_OK); |
| } |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |
| -PreParser::Statement PreParser::ParseDebuggerStatement(bool* ok) { |
| +PreParserStatement PreParser::ParseDebuggerStatement(bool* ok) { |
| // In ECMA-262 'debugger' is defined as a reserved keyword. In some browser |
| // contexts this is used as a statement which invokes the debugger as if a |
| // break point is present. |
| @@ -813,7 +813,7 @@ PreParser::Statement PreParser::ParseDebuggerStatement(bool* ok) { |
| Expect(Token::DEBUGGER, CHECK_OK); |
| ExpectSemicolon(ok); |
| - return Statement::Default(); |
| + return PreParserStatement::Default(); |
| } |