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

Side by Side Diff: src/parsing/parser-base.h

Issue 2091313002: [parser] don't report error for CoverInitializedNames in async arrow formals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: _Really_ fix compile error 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/hashmap.h" 10 #include "src/base/hashmap.h"
(...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2153 bool was_unspread = false; 2153 bool was_unspread = false;
2154 int unspread_sequences_count = 0; 2154 int unspread_sequences_count = 0;
2155 while (!done) { 2155 while (!done) {
2156 int start_pos = peek_position(); 2156 int start_pos = peek_position();
2157 bool is_spread = Check(Token::ELLIPSIS); 2157 bool is_spread = Check(Token::ELLIPSIS);
2158 int expr_pos = peek_position(); 2158 int expr_pos = peek_position();
2159 2159
2160 ExpressionT argument = this->ParseAssignmentExpression( 2160 ExpressionT argument = this->ParseAssignmentExpression(
2161 true, classifier, CHECK_OK_CUSTOM(NullExpressionList)); 2161 true, classifier, CHECK_OK_CUSTOM(NullExpressionList));
2162 CheckNoTailCallExpressions(classifier, CHECK_OK_CUSTOM(NullExpressionList)); 2162 CheckNoTailCallExpressions(classifier, CHECK_OK_CUSTOM(NullExpressionList));
2163 Traits::RewriteNonPattern(classifier, CHECK_OK_CUSTOM(NullExpressionList)); 2163 if (!maybe_arrow) {
2164 Traits::RewriteNonPattern(classifier,
2165 CHECK_OK_CUSTOM(NullExpressionList));
2166 }
2164 if (is_spread) { 2167 if (is_spread) {
2165 if (!spread_arg.IsValid()) { 2168 if (!spread_arg.IsValid()) {
2166 spread_arg.beg_pos = start_pos; 2169 spread_arg.beg_pos = start_pos;
2167 spread_arg.end_pos = peek_position(); 2170 spread_arg.end_pos = peek_position();
2168 } 2171 }
2169 argument = factory()->NewSpread(argument, start_pos, expr_pos); 2172 argument = factory()->NewSpread(argument, start_pos, expr_pos);
2170 } 2173 }
2171 result->Add(argument, zone_); 2174 result->Add(argument, zone_);
2172 2175
2173 // unspread_sequences_count is the number of sequences of parameters which 2176 // unspread_sequences_count is the number of sequences of parameters which
(...skipping 16 matching lines...) Expand all
2190 } 2193 }
2191 } 2194 }
2192 Scanner::Location location = scanner_->location(); 2195 Scanner::Location location = scanner_->location();
2193 if (Token::RPAREN != Next()) { 2196 if (Token::RPAREN != Next()) {
2194 ReportMessageAt(location, MessageTemplate::kUnterminatedArgList); 2197 ReportMessageAt(location, MessageTemplate::kUnterminatedArgList);
2195 *ok = false; 2198 *ok = false;
2196 return this->NullExpressionList(); 2199 return this->NullExpressionList();
2197 } 2200 }
2198 *first_spread_arg_loc = spread_arg; 2201 *first_spread_arg_loc = spread_arg;
2199 2202
2200 if ((!maybe_arrow || peek() != Token::ARROW) && spread_arg.IsValid()) { 2203 if (!maybe_arrow || peek() != Token::ARROW) {
2201 // Unspread parameter sequences are translated into array literals in the 2204 if (maybe_arrow) {
2202 // parser. Ensure that the number of materialized literals matches between 2205 Traits::RewriteNonPattern(classifier,
2203 // the parser and preparser 2206 CHECK_OK_CUSTOM(NullExpressionList));
2204 Traits::MaterializeUnspreadArgumentsLiterals(unspread_sequences_count); 2207 }
2208 if (spread_arg.IsValid()) {
2209 // Unspread parameter sequences are translated into array literals in the
2210 // parser. Ensure that the number of materialized literals matches between
2211 // the parser and preparser
2212 Traits::MaterializeUnspreadArgumentsLiterals(unspread_sequences_count);
2213 }
2205 } 2214 }
2206 2215
2207 return result; 2216 return result;
2208 } 2217 }
2209 2218
2210 // Precedence = 2 2219 // Precedence = 2
2211 template <class Traits> 2220 template <class Traits>
2212 typename ParserBase<Traits>::ExpressionT 2221 typename ParserBase<Traits>::ExpressionT
2213 ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, 2222 ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN,
2214 ExpressionClassifier* classifier, 2223 ExpressionClassifier* classifier,
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3621 has_seen_constructor_ = true; 3630 has_seen_constructor_ = true;
3622 return; 3631 return;
3623 } 3632 }
3624 } 3633 }
3625 3634
3626 3635
3627 } // namespace internal 3636 } // namespace internal
3628 } // namespace v8 3637 } // namespace v8
3629 3638
3630 #endif // V8_PARSING_PARSER_BASE_H 3639 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698