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/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 3747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3758 // that duplicates are not allowed. Of course, the arrow function may | 3758 // that duplicates are not allowed. Of course, the arrow function may |
3759 // itself be strict as well. | 3759 // itself be strict as well. |
3760 const bool allow_duplicate_parameters = false; | 3760 const bool allow_duplicate_parameters = false; |
3761 this->ValidateFormalParameters(&formals_classifier, language_mode(), | 3761 this->ValidateFormalParameters(&formals_classifier, language_mode(), |
3762 allow_duplicate_parameters, CHECK_OK); | 3762 allow_duplicate_parameters, CHECK_OK); |
3763 | 3763 |
3764 // Validate strict mode. | 3764 // Validate strict mode. |
3765 if (is_strict(language_mode())) { | 3765 if (is_strict(language_mode())) { |
3766 CheckStrictOctalLiteral(formal_parameters.scope->start_position(), | 3766 CheckStrictOctalLiteral(formal_parameters.scope->start_position(), |
3767 scanner()->location().end_pos, CHECK_OK); | 3767 scanner()->location().end_pos, CHECK_OK); |
3768 } | |
3769 if (is_strict(language_mode()) || allow_harmony_sloppy()) { | |
Dan Ehrenberg
2015/07/08 23:42:13
A tangent, but it looks like CheckConflictingVarDe
rossberg
2015/07/10 12:13:17
No, the preparser doesn't maintain scopes. This is
arv (Not doing code reviews)
2015/07/10 13:00:48
This is not entirely true. We do set up the scopes
| |
3768 this->CheckConflictingVarDeclarations(formal_parameters.scope, CHECK_OK); | 3770 this->CheckConflictingVarDeclarations(formal_parameters.scope, CHECK_OK); |
3769 } | 3771 } |
3770 } | 3772 } |
3771 | 3773 |
3772 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( | 3774 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( |
3773 this->EmptyIdentifierString(), ast_value_factory(), | 3775 this->EmptyIdentifierString(), ast_value_factory(), |
3774 formal_parameters.scope, body, materialized_literal_count, | 3776 formal_parameters.scope, body, materialized_literal_count, |
3775 expected_property_count, num_parameters, | 3777 expected_property_count, num_parameters, |
3776 FunctionLiteral::kNoDuplicateParameters, | 3778 FunctionLiteral::kNoDuplicateParameters, |
3777 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction, | 3779 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3973 *ok = false; | 3975 *ok = false; |
3974 return; | 3976 return; |
3975 } | 3977 } |
3976 has_seen_constructor_ = true; | 3978 has_seen_constructor_ = true; |
3977 return; | 3979 return; |
3978 } | 3980 } |
3979 } | 3981 } |
3980 } } // v8::internal | 3982 } } // v8::internal |
3981 | 3983 |
3982 #endif // V8_PREPARSER_H | 3984 #endif // V8_PREPARSER_H |
OLD | NEW |