Commit cb13d50a authored by nikolaos's avatar nikolaos Committed by Commit bot

[parser] Minor cleanup after refactoring

- Remove redundant "impl()->".
- Remove NewBlock method from "impl()", exists in "factory()".
- Resolve TODO comments.

R=adamk@chromium.org, marja@chromium.org
BUG=
LOG=N

Review-Url: https://codereview.chromium.org/2345103003
Cr-Commit-Position: refs/heads/master@{#39496}
parent 80033652
...@@ -3591,8 +3591,8 @@ typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseVariableDeclarations( ...@@ -3591,8 +3591,8 @@ typename ParserBase<Impl>::BlockT ParserBase<Impl>::ParseVariableDeclarations(
BlockT init_block = impl()->NullBlock(); BlockT init_block = impl()->NullBlock();
if (var_context != kForStatement) { if (var_context != kForStatement) {
init_block = impl()->NewBlock(nullptr, 1, true, init_block = factory()->NewBlock(
parsing_result->descriptor.declaration_pos); nullptr, 1, true, parsing_result->descriptor.declaration_pos);
} }
switch (peek()) { switch (peek()) {
...@@ -4194,8 +4194,8 @@ ParserBase<Impl>::ParseStatementList(StatementListT body, int end_token, ...@@ -4194,8 +4194,8 @@ ParserBase<Impl>::ParseStatementList(StatementListT body, int end_token,
bool starts_with_identifier = peek() == Token::IDENTIFIER; bool starts_with_identifier = peek() == Token::IDENTIFIER;
Scanner::Location token_loc = scanner()->peek_location(); Scanner::Location token_loc = scanner()->peek_location();
StatementT stat = impl()->ParseStatementListItem( StatementT stat =
CHECK_OK_CUSTOM(Return, kLazyParsingComplete)); ParseStatementListItem(CHECK_OK_CUSTOM(Return, kLazyParsingComplete));
if (impl()->IsNullStatement(stat) || impl()->IsEmptyStatement(stat)) { if (impl()->IsNullStatement(stat) || impl()->IsEmptyStatement(stat)) {
directive_prologue = false; // End of directive prologue. directive_prologue = false; // End of directive prologue.
...@@ -4233,18 +4233,15 @@ ParserBase<Impl>::ParseStatementList(StatementListT body, int end_token, ...@@ -4233,18 +4233,15 @@ ParserBase<Impl>::ParseStatementList(StatementListT body, int end_token,
impl()->SetAsmModule(); impl()->SetAsmModule();
} else if (impl()->IsStringLiteral(stat)) { } else if (impl()->IsStringLiteral(stat)) {
// Possibly an unknown directive. // Possibly an unknown directive.
// TODO(nikolaos): Check if the following is really what we want! // Should not change mode, but will increment usage counters
// """Should not change mode, but will increment UseCounter // as appropriate. Ditto usages below.
// if appropriate. Ditto usages below.""" ???
RaiseLanguageMode(SLOPPY); RaiseLanguageMode(SLOPPY);
} else { } else {
// End of the directive prologue. // End of the directive prologue.
directive_prologue = false; directive_prologue = false;
// TODO(nikolaos): Check if the following is really what we want!
RaiseLanguageMode(SLOPPY); RaiseLanguageMode(SLOPPY);
} }
} else { } else {
// TODO(nikolaos): Check if the following is really what we want!
RaiseLanguageMode(SLOPPY); RaiseLanguageMode(SLOPPY);
} }
...@@ -4287,7 +4284,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatementListItem( ...@@ -4287,7 +4284,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatementListItem(
switch (peek()) { switch (peek()) {
case Token::FUNCTION: case Token::FUNCTION:
return impl()->ParseHoistableDeclaration(nullptr, false, ok); return ParseHoistableDeclaration(nullptr, false, ok);
case Token::CLASS: case Token::CLASS:
Consume(Token::CLASS); Consume(Token::CLASS);
return impl()->ParseClassDeclaration(nullptr, false, ok); return impl()->ParseClassDeclaration(nullptr, false, ok);
...@@ -4309,7 +4306,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatementListItem( ...@@ -4309,7 +4306,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatementListItem(
default: default:
break; break;
} }
return impl()->ParseStatement(nullptr, kAllowLabelledFunctionStatement, ok); return ParseStatement(nullptr, kAllowLabelledFunctionStatement, ok);
} }
template <typename Impl> template <typename Impl>
...@@ -4341,7 +4338,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatement( ...@@ -4341,7 +4338,7 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseStatement(
// parsed into an empty statement. // parsed into an empty statement.
switch (peek()) { switch (peek()) {
case Token::LBRACE: case Token::LBRACE:
return impl()->ParseBlock(labels, ok); return ParseBlock(labels, ok);
case Token::SEMICOLON: case Token::SEMICOLON:
Next(); Next();
return factory()->NewEmptyStatement(kNoSourcePosition); return factory()->NewEmptyStatement(kNoSourcePosition);
......
...@@ -960,11 +960,6 @@ class Parser : public ParserBase<Parser> { ...@@ -960,11 +960,6 @@ class Parser : public ParserBase<Parser> {
return new (zone()) ZoneList<CaseClause*>(size, zone()); return new (zone()) ZoneList<CaseClause*>(size, zone());
} }
V8_INLINE Block* NewBlock(ZoneList<const AstRawString*>* labels, int capacity,
bool ignore_completion_value, int pos) {
return factory()->NewBlock(labels, capacity, ignore_completion_value, pos);
}
V8_INLINE Expression* NewV8Intrinsic(const AstRawString* name, V8_INLINE Expression* NewV8Intrinsic(const AstRawString* name,
ZoneList<Expression*>* args, int pos, ZoneList<Expression*>* args, int pos,
bool* ok); bool* ok);
......
...@@ -1289,12 +1289,6 @@ class PreParser : public ParserBase<PreParser> { ...@@ -1289,12 +1289,6 @@ class PreParser : public ParserBase<PreParser> {
return PreParserStatementList(); return PreParserStatementList();
} }
V8_INLINE static PreParserStatement NewBlock(
ZoneList<const AstRawString*>* labels, int capacity,
bool ignore_completion_value, int pos) {
return PreParserStatement::Default();
}
V8_INLINE PreParserExpression V8_INLINE PreParserExpression
NewV8Intrinsic(PreParserIdentifier name, PreParserExpressionList arguments, NewV8Intrinsic(PreParserIdentifier name, PreParserExpressionList arguments,
int pos, bool* ok) { int pos, bool* ok) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment