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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/bailout-reason.h" | 8 #include "src/bailout-reason.h" |
9 #include "src/expression-classifier.h" | 9 #include "src/expression-classifier.h" |
10 #include "src/func-name-inferrer.h" | 10 #include "src/func-name-inferrer.h" |
(...skipping 2917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2928 return factory()->NewAssignment(op, expression, right, pos); | 2928 return factory()->NewAssignment(op, expression, right, pos); |
2929 } | 2929 } |
2930 | 2930 |
2931 template <class Traits> | 2931 template <class Traits> |
2932 typename ParserBase<Traits>::ExpressionT | 2932 typename ParserBase<Traits>::ExpressionT |
2933 ParserBase<Traits>::ParseYieldExpression(ExpressionClassifier* classifier, | 2933 ParserBase<Traits>::ParseYieldExpression(ExpressionClassifier* classifier, |
2934 bool* ok) { | 2934 bool* ok) { |
2935 // YieldExpression :: | 2935 // YieldExpression :: |
2936 // 'yield' ([no line terminator] '*'? AssignmentExpression)? | 2936 // 'yield' ([no line terminator] '*'? AssignmentExpression)? |
2937 int pos = peek_position(); | 2937 int pos = peek_position(); |
| 2938 BindingPatternUnexpectedToken(classifier); |
2938 Expect(Token::YIELD, CHECK_OK); | 2939 Expect(Token::YIELD, CHECK_OK); |
2939 ExpressionT generator_object = | 2940 ExpressionT generator_object = |
2940 factory()->NewVariableProxy(function_state_->generator_object_variable()); | 2941 factory()->NewVariableProxy(function_state_->generator_object_variable()); |
2941 ExpressionT expression = Traits::EmptyExpression(); | 2942 ExpressionT expression = Traits::EmptyExpression(); |
2942 Yield::Kind kind = Yield::kSuspend; | 2943 Yield::Kind kind = Yield::kSuspend; |
2943 if (!scanner()->HasAnyLineTerminatorBeforeNext()) { | 2944 if (!scanner()->HasAnyLineTerminatorBeforeNext()) { |
2944 if (Check(Token::MUL)) kind = Yield::kDelegating; | 2945 if (Check(Token::MUL)) kind = Yield::kDelegating; |
2945 switch (peek()) { | 2946 switch (peek()) { |
2946 case Token::EOS: | 2947 case Token::EOS: |
2947 case Token::SEMICOLON: | 2948 case Token::SEMICOLON: |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4060 *ok = false; | 4061 *ok = false; |
4061 return; | 4062 return; |
4062 } | 4063 } |
4063 has_seen_constructor_ = true; | 4064 has_seen_constructor_ = true; |
4064 return; | 4065 return; |
4065 } | 4066 } |
4066 } | 4067 } |
4067 } } // v8::internal | 4068 } } // v8::internal |
4068 | 4069 |
4069 #endif // V8_PREPARSER_H | 4070 #endif // V8_PREPARSER_H |
OLD | NEW |