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 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2935 } | 2935 } |
2936 ExpressionT expression = this->ParseConditionalExpression( | 2936 ExpressionT expression = this->ParseConditionalExpression( |
2937 accept_IN, &arrow_formals_classifier, CHECK_OK); | 2937 accept_IN, &arrow_formals_classifier, CHECK_OK); |
2938 if (peek() == Token::ARROW) { | 2938 if (peek() == Token::ARROW) { |
2939 BindingPatternUnexpectedToken(classifier); | 2939 BindingPatternUnexpectedToken(classifier); |
2940 ValidateArrowFormalParameters(&arrow_formals_classifier, expression, | 2940 ValidateArrowFormalParameters(&arrow_formals_classifier, expression, |
2941 parenthesized_formals, CHECK_OK); | 2941 parenthesized_formals, CHECK_OK); |
2942 Scanner::Location loc(lhs_beg_pos, scanner()->location().end_pos); | 2942 Scanner::Location loc(lhs_beg_pos, scanner()->location().end_pos); |
2943 Scope* scope = | 2943 Scope* scope = |
2944 this->NewScope(scope_, FUNCTION_SCOPE, FunctionKind::kArrowFunction); | 2944 this->NewScope(scope_, FUNCTION_SCOPE, FunctionKind::kArrowFunction); |
| 2945 // Because the arrow's parameters were parsed in the outer scope, any |
| 2946 // usage flags that might have been triggered there need to be copied |
| 2947 // to the arrow scope. |
| 2948 scope_->PropagateUsageFlagsToScope(scope); |
2945 FormalParametersT parameters(scope); | 2949 FormalParametersT parameters(scope); |
2946 if (!arrow_formals_classifier.is_simple_parameter_list()) { | 2950 if (!arrow_formals_classifier.is_simple_parameter_list()) { |
2947 scope->SetHasNonSimpleParameters(); | 2951 scope->SetHasNonSimpleParameters(); |
2948 parameters.is_simple = false; | 2952 parameters.is_simple = false; |
2949 } | 2953 } |
2950 | 2954 |
2951 Scanner::Location duplicate_loc = Scanner::Location::invalid(); | 2955 Scanner::Location duplicate_loc = Scanner::Location::invalid(); |
2952 this->ParseArrowFunctionFormalParameterList(¶meters, expression, loc, | 2956 this->ParseArrowFunctionFormalParameterList(¶meters, expression, loc, |
2953 &duplicate_loc, CHECK_OK); | 2957 &duplicate_loc, CHECK_OK); |
2954 | 2958 |
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4200 return; | 4204 return; |
4201 } | 4205 } |
4202 has_seen_constructor_ = true; | 4206 has_seen_constructor_ = true; |
4203 return; | 4207 return; |
4204 } | 4208 } |
4205 } | 4209 } |
4206 } // namespace internal | 4210 } // namespace internal |
4207 } // namespace v8 | 4211 } // namespace v8 |
4208 | 4212 |
4209 #endif // V8_PREPARSER_H | 4213 #endif // V8_PREPARSER_H |
OLD | NEW |