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

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

Issue 1632303002: Treat yield expressions as an AssignmentPattern error (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added test Created 4 years, 11 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/hashmap.h" 10 #include "src/hashmap.h"
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after
2101 return result; 2101 return result;
2102 } 2102 }
2103 2103
2104 template <class Traits> 2104 template <class Traits>
2105 typename ParserBase<Traits>::ExpressionT 2105 typename ParserBase<Traits>::ExpressionT
2106 ParserBase<Traits>::ParseYieldExpression(ExpressionClassifier* classifier, 2106 ParserBase<Traits>::ParseYieldExpression(ExpressionClassifier* classifier,
2107 bool* ok) { 2107 bool* ok) {
2108 // YieldExpression :: 2108 // YieldExpression ::
2109 // 'yield' ([no line terminator] '*'? AssignmentExpression)? 2109 // 'yield' ([no line terminator] '*'? AssignmentExpression)?
2110 int pos = peek_position(); 2110 int pos = peek_position();
2111 BindingPatternUnexpectedToken(classifier); 2111 classifier->RecordPatternError(scanner()->peek_location(),
2112 MessageTemplate::kInvalidDestructuringTarget);
2112 FormalParameterInitializerUnexpectedToken(classifier); 2113 FormalParameterInitializerUnexpectedToken(classifier);
2113 Expect(Token::YIELD, CHECK_OK); 2114 Expect(Token::YIELD, CHECK_OK);
2114 ExpressionT generator_object = 2115 ExpressionT generator_object =
2115 factory()->NewVariableProxy(function_state_->generator_object_variable()); 2116 factory()->NewVariableProxy(function_state_->generator_object_variable());
2116 ExpressionT expression = Traits::EmptyExpression(); 2117 ExpressionT expression = Traits::EmptyExpression();
2117 Yield::Kind kind = Yield::kSuspend; 2118 Yield::Kind kind = Yield::kSuspend;
2118 if (!scanner()->HasAnyLineTerminatorBeforeNext()) { 2119 if (!scanner()->HasAnyLineTerminatorBeforeNext()) {
2119 if (Check(Token::MUL)) kind = Yield::kDelegating; 2120 if (Check(Token::MUL)) kind = Yield::kDelegating;
2120 switch (peek()) { 2121 switch (peek()) {
2121 case Token::EOS: 2122 case Token::EOS:
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
3337 return; 3338 return;
3338 } 3339 }
3339 has_seen_constructor_ = true; 3340 has_seen_constructor_ = true;
3340 return; 3341 return;
3341 } 3342 }
3342 } 3343 }
3343 } // namespace internal 3344 } // namespace internal
3344 } // namespace v8 3345 } // namespace v8
3345 3346
3346 #endif // V8_PARSING_PARSER_BASE_H 3347 #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