| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 allow_strong_mode_(false) {} | 93 allow_strong_mode_(false) {} |
| 94 | 94 |
| 95 // Getters that indicate whether certain syntactical constructs are | 95 // Getters that indicate whether certain syntactical constructs are |
| 96 // allowed to be parsed by this instance of the parser. | 96 // allowed to be parsed by this instance of the parser. |
| 97 bool allow_lazy() const { return allow_lazy_; } | 97 bool allow_lazy() const { return allow_lazy_; } |
| 98 bool allow_natives() const { return allow_natives_; } | 98 bool allow_natives() const { return allow_natives_; } |
| 99 bool allow_harmony_arrow_functions() const { | 99 bool allow_harmony_arrow_functions() const { |
| 100 return allow_harmony_arrow_functions_; | 100 return allow_harmony_arrow_functions_; |
| 101 } | 101 } |
| 102 bool allow_harmony_modules() const { return scanner()->HarmonyModules(); } | 102 bool allow_harmony_modules() const { return scanner()->HarmonyModules(); } |
| 103 bool allow_harmony_scoping() const { return scanner()->HarmonyScoping(); } | |
| 104 bool allow_harmony_numeric_literals() const { | 103 bool allow_harmony_numeric_literals() const { |
| 105 return scanner()->HarmonyNumericLiterals(); | 104 return scanner()->HarmonyNumericLiterals(); |
| 106 } | 105 } |
| 107 bool allow_harmony_classes() const { return scanner()->HarmonyClasses(); } | 106 bool allow_harmony_classes() const { return scanner()->HarmonyClasses(); } |
| 108 bool allow_harmony_object_literals() const { | 107 bool allow_harmony_object_literals() const { |
| 109 return allow_harmony_object_literals_; | 108 return allow_harmony_object_literals_; |
| 110 } | 109 } |
| 111 bool allow_harmony_templates() const { return scanner()->HarmonyTemplates(); } | 110 bool allow_harmony_templates() const { return scanner()->HarmonyTemplates(); } |
| 112 bool allow_harmony_sloppy() const { return allow_harmony_sloppy_; } | 111 bool allow_harmony_sloppy() const { return allow_harmony_sloppy_; } |
| 113 bool allow_harmony_unicode() const { return scanner()->HarmonyUnicode(); } | 112 bool allow_harmony_unicode() const { return scanner()->HarmonyUnicode(); } |
| 114 bool allow_harmony_computed_property_names() const { | 113 bool allow_harmony_computed_property_names() const { |
| 115 return allow_harmony_computed_property_names_; | 114 return allow_harmony_computed_property_names_; |
| 116 } | 115 } |
| 117 bool allow_harmony_rest_params() const { | 116 bool allow_harmony_rest_params() const { |
| 118 return allow_harmony_rest_params_; | 117 return allow_harmony_rest_params_; |
| 119 } | 118 } |
| 120 | 119 |
| 121 bool allow_strong_mode() const { return allow_strong_mode_; } | 120 bool allow_strong_mode() const { return allow_strong_mode_; } |
| 122 | 121 |
| 123 // Setters that determine whether certain syntactical constructs are | 122 // Setters that determine whether certain syntactical constructs are |
| 124 // allowed to be parsed by this instance of the parser. | 123 // allowed to be parsed by this instance of the parser. |
| 125 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } | 124 void set_allow_lazy(bool allow) { allow_lazy_ = allow; } |
| 126 void set_allow_natives(bool allow) { allow_natives_ = allow; } | 125 void set_allow_natives(bool allow) { allow_natives_ = allow; } |
| 127 void set_allow_harmony_arrow_functions(bool allow) { | 126 void set_allow_harmony_arrow_functions(bool allow) { |
| 128 allow_harmony_arrow_functions_ = allow; | 127 allow_harmony_arrow_functions_ = allow; |
| 129 } | 128 } |
| 130 void set_allow_harmony_modules(bool allow) { | 129 void set_allow_harmony_modules(bool allow) { |
| 131 scanner()->SetHarmonyModules(allow); | 130 scanner()->SetHarmonyModules(allow); |
| 132 } | 131 } |
| 133 void set_allow_harmony_scoping(bool allow) { | |
| 134 scanner()->SetHarmonyScoping(allow); | |
| 135 } | |
| 136 void set_allow_harmony_numeric_literals(bool allow) { | 132 void set_allow_harmony_numeric_literals(bool allow) { |
| 137 scanner()->SetHarmonyNumericLiterals(allow); | 133 scanner()->SetHarmonyNumericLiterals(allow); |
| 138 } | 134 } |
| 139 void set_allow_harmony_classes(bool allow) { | 135 void set_allow_harmony_classes(bool allow) { |
| 140 scanner()->SetHarmonyClasses(allow); | 136 scanner()->SetHarmonyClasses(allow); |
| 141 } | 137 } |
| 142 void set_allow_harmony_object_literals(bool allow) { | 138 void set_allow_harmony_object_literals(bool allow) { |
| 143 allow_harmony_object_literals_ = allow; | 139 allow_harmony_object_literals_ = allow; |
| 144 } | 140 } |
| 145 void set_allow_harmony_templates(bool allow) { | 141 void set_allow_harmony_templates(bool allow) { |
| (...skipping 2789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2935 Scanner::Location eval_args_error_loc = Scanner::Location::invalid(); | 2931 Scanner::Location eval_args_error_loc = Scanner::Location::invalid(); |
| 2936 Scanner::Location reserved_loc = Scanner::Location::invalid(); | 2932 Scanner::Location reserved_loc = Scanner::Location::invalid(); |
| 2937 const bool use_strict_params = true; | 2933 const bool use_strict_params = true; |
| 2938 this->CheckFunctionParameterNames(language_mode(), use_strict_params, | 2934 this->CheckFunctionParameterNames(language_mode(), use_strict_params, |
| 2939 eval_args_error_loc, dupe_error_loc, reserved_loc, CHECK_OK); | 2935 eval_args_error_loc, dupe_error_loc, reserved_loc, CHECK_OK); |
| 2940 | 2936 |
| 2941 // Validate strict mode. | 2937 // Validate strict mode. |
| 2942 if (is_strict(language_mode())) { | 2938 if (is_strict(language_mode())) { |
| 2943 CheckStrictOctalLiteral(start_pos, scanner()->location().end_pos, | 2939 CheckStrictOctalLiteral(start_pos, scanner()->location().end_pos, |
| 2944 CHECK_OK); | 2940 CHECK_OK); |
| 2941 this->CheckConflictingVarDeclarations(scope, CHECK_OK); |
| 2945 } | 2942 } |
| 2946 | |
| 2947 if (allow_harmony_scoping() && is_strict(language_mode())) | |
| 2948 this->CheckConflictingVarDeclarations(scope, CHECK_OK); | |
| 2949 } | 2943 } |
| 2950 | 2944 |
| 2951 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( | 2945 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( |
| 2952 this->EmptyIdentifierString(), ast_value_factory(), scope, body, | 2946 this->EmptyIdentifierString(), ast_value_factory(), scope, body, |
| 2953 materialized_literal_count, expected_property_count, handler_count, | 2947 materialized_literal_count, expected_property_count, handler_count, |
| 2954 num_parameters, FunctionLiteral::kNoDuplicateParameters, | 2948 num_parameters, FunctionLiteral::kNoDuplicateParameters, |
| 2955 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction, | 2949 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction, |
| 2956 FunctionLiteral::kNotParenthesized, FunctionKind::kArrowFunction, | 2950 FunctionLiteral::kNotParenthesized, FunctionKind::kArrowFunction, |
| 2957 start_pos); | 2951 start_pos); |
| 2958 | 2952 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3134 *ok = false; | 3128 *ok = false; |
| 3135 return; | 3129 return; |
| 3136 } | 3130 } |
| 3137 has_seen_constructor_ = true; | 3131 has_seen_constructor_ = true; |
| 3138 return; | 3132 return; |
| 3139 } | 3133 } |
| 3140 } | 3134 } |
| 3141 } } // v8::internal | 3135 } } // v8::internal |
| 3142 | 3136 |
| 3143 #endif // V8_PREPARSER_H | 3137 #endif // V8_PREPARSER_H |
| OLD | NEW |