| 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 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |