OLD | NEW |
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 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2144 return result; | 2144 return result; |
2145 } | 2145 } |
2146 | 2146 |
2147 template <class Traits> | 2147 template <class Traits> |
2148 typename ParserBase<Traits>::ExpressionT | 2148 typename ParserBase<Traits>::ExpressionT |
2149 ParserBase<Traits>::ParseYieldExpression(ExpressionClassifier* classifier, | 2149 ParserBase<Traits>::ParseYieldExpression(ExpressionClassifier* classifier, |
2150 bool* ok) { | 2150 bool* ok) { |
2151 // YieldExpression :: | 2151 // YieldExpression :: |
2152 // 'yield' ([no line terminator] '*'? AssignmentExpression)? | 2152 // 'yield' ([no line terminator] '*'? AssignmentExpression)? |
2153 int pos = peek_position(); | 2153 int pos = peek_position(); |
2154 BindingPatternUnexpectedToken(classifier); | 2154 classifier->RecordPatternError(scanner()->peek_location(), |
| 2155 MessageTemplate::kInvalidDestructuringTarget); |
2155 FormalParameterInitializerUnexpectedToken(classifier); | 2156 FormalParameterInitializerUnexpectedToken(classifier); |
2156 Expect(Token::YIELD, CHECK_OK); | 2157 Expect(Token::YIELD, CHECK_OK); |
2157 ExpressionT generator_object = | 2158 ExpressionT generator_object = |
2158 factory()->NewVariableProxy(function_state_->generator_object_variable()); | 2159 factory()->NewVariableProxy(function_state_->generator_object_variable()); |
2159 ExpressionT expression = Traits::EmptyExpression(); | 2160 ExpressionT expression = Traits::EmptyExpression(); |
2160 Yield::Kind kind = Yield::kSuspend; | 2161 Yield::Kind kind = Yield::kSuspend; |
2161 if (!scanner()->HasAnyLineTerminatorBeforeNext()) { | 2162 if (!scanner()->HasAnyLineTerminatorBeforeNext()) { |
2162 if (Check(Token::MUL)) kind = Yield::kDelegating; | 2163 if (Check(Token::MUL)) kind = Yield::kDelegating; |
2163 switch (peek()) { | 2164 switch (peek()) { |
2164 case Token::EOS: | 2165 case Token::EOS: |
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3371 return; | 3372 return; |
3372 } | 3373 } |
3373 has_seen_constructor_ = true; | 3374 has_seen_constructor_ = true; |
3374 return; | 3375 return; |
3375 } | 3376 } |
3376 } | 3377 } |
3377 } // namespace internal | 3378 } // namespace internal |
3378 } // namespace v8 | 3379 } // namespace v8 |
3379 | 3380 |
3380 #endif // V8_PARSING_PARSER_BASE_H | 3381 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |