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

Unified Diff: src/parsing/parser-base.h

Issue 2162763003: [parser] Add default constructor for PreParserExpression (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | src/parsing/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 92377acc7aa303382437f4d6e4c3b6f10dc4debc..bfdebcf805e773231be6b0f1dcc4ba68e273068a 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -1693,7 +1693,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseExpression(
// AssignmentExpression
// Expression ',' AssignmentExpression
- ExpressionT result = this->EmptyExpression();
+ ExpressionT result;
{
ExpressionClassifier binding_classifier(this);
result = this->ParseAssignmentExpression(accept_IN, &binding_classifier,
@@ -1764,7 +1764,7 @@ typename ParserBase<Traits>::ExpressionT ParserBase<Traits>::ParseArrayLiteral(
int first_spread_index = -1;
Expect(Token::LBRACK, CHECK_OK);
while (peek() != Token::RBRACK) {
- ExpressionT elem = this->EmptyExpression();
+ ExpressionT elem;
if (peek() == Token::COMMA) {
elem = this->GetLiteralTheHole(peek_position(), factory());
} else if (peek() == Token::ELLIPSIS) {
@@ -1896,7 +1896,6 @@ ParserBase<Traits>::ParsePropertyDefinition(
ExpressionClassifier* classifier, IdentifierT* name, bool* ok) {
DCHECK(!in_class || IsStaticMethod(method_kind) ||
has_seen_constructor != nullptr);
- ExpressionT value = this->EmptyExpression();
bool is_get = false;
bool is_set = false;
bool is_await = false;
@@ -1936,7 +1935,7 @@ ParserBase<Traits>::ParsePropertyDefinition(
}
Consume(Token::COLON);
int beg_pos = peek_position();
- value = this->ParseAssignmentExpression(
+ ExpressionT value = this->ParseAssignmentExpression(
true, classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
CheckDestructuringElement(value, classifier, beg_pos,
scanner()->location().end_pos);
@@ -1978,6 +1977,7 @@ ParserBase<Traits>::ParsePropertyDefinition(
*name, next_beg_pos, next_end_pos, scope_, factory());
CheckDestructuringElement(lhs, classifier, next_beg_pos, next_end_pos);
+ ExpressionT value;
if (peek() == Token::ASSIGN) {
Consume(Token::ASSIGN);
ExpressionClassifier rhs_classifier(this);
@@ -2040,7 +2040,7 @@ ParserBase<Traits>::ParsePropertyDefinition(
: FunctionKind::kBaseConstructor;
}
- value = this->ParseFunctionLiteral(
+ ExpressionT value = this->ParseFunctionLiteral(
*name, scanner()->location(), kSkipFunctionNameCheck, kind,
kNoSourcePosition, FunctionLiteral::kAccessorOrMethod, language_mode(),
CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
@@ -2450,6 +2450,7 @@ ParserBase<Traits>::ParseYieldExpression(bool accept_IN,
Expect(Token::YIELD, CHECK_OK);
ExpressionT generator_object =
factory()->NewVariableProxy(function_state_->generator_object_variable());
+ // The following initialization is necessary.
ExpressionT expression = Traits::EmptyExpression();
bool delegating = false; // yield*
if (!scanner()->HasAnyLineTerminatorBeforeNext()) {
@@ -2952,7 +2953,7 @@ ParserBase<Traits>::ParseMemberWithNewPrefixesExpression(
ArrowFormalParametersUnexpectedToken(classifier);
Consume(Token::NEW);
int new_pos = position();
- ExpressionT result = this->EmptyExpression();
+ ExpressionT result;
if (peek() == Token::SUPER) {
const bool is_new = true;
result = ParseSuperExpression(is_new, classifier, CHECK_OK);
@@ -3001,7 +3002,7 @@ ParserBase<Traits>::ParseMemberExpression(ExpressionClassifier* classifier,
// caller.
// Parse the initial primary or function expression.
- ExpressionT result = this->EmptyExpression();
+ ExpressionT result;
if (peek() == Token::FUNCTION) {
BindingPatternUnexpectedToken(classifier);
ArrowFormalParametersUnexpectedToken(classifier);
« no previous file with comments | « no previous file | src/parsing/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698