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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 allow_natives_(false), | 110 allow_natives_(false), |
111 allow_harmony_sloppy_(false), | 111 allow_harmony_sloppy_(false), |
112 allow_harmony_sloppy_function_(false), | 112 allow_harmony_sloppy_function_(false), |
113 allow_harmony_sloppy_let_(false), | 113 allow_harmony_sloppy_let_(false), |
114 allow_harmony_rest_parameters_(false), | 114 allow_harmony_rest_parameters_(false), |
115 allow_harmony_default_parameters_(false), | 115 allow_harmony_default_parameters_(false), |
116 allow_harmony_destructuring_bind_(false), | 116 allow_harmony_destructuring_bind_(false), |
117 allow_harmony_destructuring_assignment_(false), | 117 allow_harmony_destructuring_assignment_(false), |
118 allow_strong_mode_(false), | 118 allow_strong_mode_(false), |
119 allow_legacy_const_(true), | 119 allow_legacy_const_(true), |
120 allow_harmony_do_expressions_(false) {} | 120 allow_harmony_do_expressions_(false), |
| 121 allow_harmony_function_name_(false) {} |
121 | 122 |
122 #define ALLOW_ACCESSORS(name) \ | 123 #define ALLOW_ACCESSORS(name) \ |
123 bool allow_##name() const { return allow_##name##_; } \ | 124 bool allow_##name() const { return allow_##name##_; } \ |
124 void set_allow_##name(bool allow) { allow_##name##_ = allow; } | 125 void set_allow_##name(bool allow) { allow_##name##_ = allow; } |
125 | 126 |
126 ALLOW_ACCESSORS(lazy); | 127 ALLOW_ACCESSORS(lazy); |
127 ALLOW_ACCESSORS(natives); | 128 ALLOW_ACCESSORS(natives); |
128 ALLOW_ACCESSORS(harmony_sloppy); | 129 ALLOW_ACCESSORS(harmony_sloppy); |
129 ALLOW_ACCESSORS(harmony_sloppy_function); | 130 ALLOW_ACCESSORS(harmony_sloppy_function); |
130 ALLOW_ACCESSORS(harmony_sloppy_let); | 131 ALLOW_ACCESSORS(harmony_sloppy_let); |
131 ALLOW_ACCESSORS(harmony_rest_parameters); | 132 ALLOW_ACCESSORS(harmony_rest_parameters); |
132 ALLOW_ACCESSORS(harmony_default_parameters); | 133 ALLOW_ACCESSORS(harmony_default_parameters); |
133 ALLOW_ACCESSORS(harmony_destructuring_bind); | 134 ALLOW_ACCESSORS(harmony_destructuring_bind); |
134 ALLOW_ACCESSORS(harmony_destructuring_assignment); | 135 ALLOW_ACCESSORS(harmony_destructuring_assignment); |
135 ALLOW_ACCESSORS(strong_mode); | 136 ALLOW_ACCESSORS(strong_mode); |
136 ALLOW_ACCESSORS(legacy_const); | 137 ALLOW_ACCESSORS(legacy_const); |
137 ALLOW_ACCESSORS(harmony_do_expressions); | 138 ALLOW_ACCESSORS(harmony_do_expressions); |
| 139 ALLOW_ACCESSORS(harmony_function_name); |
138 #undef ALLOW_ACCESSORS | 140 #undef ALLOW_ACCESSORS |
139 | 141 |
140 uintptr_t stack_limit() const { return stack_limit_; } | 142 uintptr_t stack_limit() const { return stack_limit_; } |
141 | 143 |
142 protected: | 144 protected: |
143 enum AllowRestrictedIdentifiers { | 145 enum AllowRestrictedIdentifiers { |
144 kAllowRestrictedIdentifiers, | 146 kAllowRestrictedIdentifiers, |
145 kDontAllowRestrictedIdentifiers | 147 kDontAllowRestrictedIdentifiers |
146 }; | 148 }; |
147 | 149 |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 bool allow_harmony_sloppy_; | 918 bool allow_harmony_sloppy_; |
917 bool allow_harmony_sloppy_function_; | 919 bool allow_harmony_sloppy_function_; |
918 bool allow_harmony_sloppy_let_; | 920 bool allow_harmony_sloppy_let_; |
919 bool allow_harmony_rest_parameters_; | 921 bool allow_harmony_rest_parameters_; |
920 bool allow_harmony_default_parameters_; | 922 bool allow_harmony_default_parameters_; |
921 bool allow_harmony_destructuring_bind_; | 923 bool allow_harmony_destructuring_bind_; |
922 bool allow_harmony_destructuring_assignment_; | 924 bool allow_harmony_destructuring_assignment_; |
923 bool allow_strong_mode_; | 925 bool allow_strong_mode_; |
924 bool allow_legacy_const_; | 926 bool allow_legacy_const_; |
925 bool allow_harmony_do_expressions_; | 927 bool allow_harmony_do_expressions_; |
| 928 bool allow_harmony_function_name_; |
926 }; | 929 }; |
927 | 930 |
928 | 931 |
929 template <class Traits> | 932 template <class Traits> |
930 ParserBase<Traits>::FunctionState::FunctionState( | 933 ParserBase<Traits>::FunctionState::FunctionState( |
931 FunctionState** function_state_stack, Scope** scope_stack, Scope* scope, | 934 FunctionState** function_state_stack, Scope** scope_stack, Scope* scope, |
932 FunctionKind kind, typename Traits::Type::Factory* factory) | 935 FunctionKind kind, typename Traits::Type::Factory* factory) |
933 : next_materialized_literal_index_(0), | 936 : next_materialized_literal_index_(0), |
934 expected_property_count_(0), | 937 expected_property_count_(0), |
935 this_location_(Scanner::Location::invalid()), | 938 this_location_(Scanner::Location::invalid()), |
(...skipping 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3349 return; | 3352 return; |
3350 } | 3353 } |
3351 has_seen_constructor_ = true; | 3354 has_seen_constructor_ = true; |
3352 return; | 3355 return; |
3353 } | 3356 } |
3354 } | 3357 } |
3355 } // namespace internal | 3358 } // namespace internal |
3356 } // namespace v8 | 3359 } // namespace v8 |
3357 | 3360 |
3358 #endif // V8_PARSING_PARSER_BASE_H | 3361 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |