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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 mode_(PARSE_EAGERLY), // Lazy mode must be set explicitly. | 107 mode_(PARSE_EAGERLY), // Lazy mode must be set explicitly. |
108 stack_limit_(stack_limit), | 108 stack_limit_(stack_limit), |
109 zone_(zone), | 109 zone_(zone), |
110 scanner_(scanner), | 110 scanner_(scanner), |
111 stack_overflow_(false), | 111 stack_overflow_(false), |
112 allow_lazy_(false), | 112 allow_lazy_(false), |
113 allow_natives_(false), | 113 allow_natives_(false), |
114 allow_tailcalls_(false), | 114 allow_tailcalls_(false), |
115 allow_harmony_restrictive_declarations_(false), | 115 allow_harmony_restrictive_declarations_(false), |
116 allow_harmony_do_expressions_(false), | 116 allow_harmony_do_expressions_(false), |
| 117 allow_harmony_for_in_(false), |
117 allow_harmony_function_name_(false), | 118 allow_harmony_function_name_(false), |
118 allow_harmony_function_sent_(false) {} | 119 allow_harmony_function_sent_(false) {} |
119 | 120 |
120 #define ALLOW_ACCESSORS(name) \ | 121 #define ALLOW_ACCESSORS(name) \ |
121 bool allow_##name() const { return allow_##name##_; } \ | 122 bool allow_##name() const { return allow_##name##_; } \ |
122 void set_allow_##name(bool allow) { allow_##name##_ = allow; } | 123 void set_allow_##name(bool allow) { allow_##name##_ = allow; } |
123 | 124 |
124 #define SCANNER_ACCESSORS(name) \ | 125 #define SCANNER_ACCESSORS(name) \ |
125 bool allow_##name() const { return scanner_->allow_##name(); } \ | 126 bool allow_##name() const { return scanner_->allow_##name(); } \ |
126 void set_allow_##name(bool allow) { \ | 127 void set_allow_##name(bool allow) { \ |
127 return scanner_->set_allow_##name(allow); \ | 128 return scanner_->set_allow_##name(allow); \ |
128 } | 129 } |
129 | 130 |
130 ALLOW_ACCESSORS(lazy); | 131 ALLOW_ACCESSORS(lazy); |
131 ALLOW_ACCESSORS(natives); | 132 ALLOW_ACCESSORS(natives); |
132 ALLOW_ACCESSORS(tailcalls); | 133 ALLOW_ACCESSORS(tailcalls); |
133 ALLOW_ACCESSORS(harmony_restrictive_declarations); | 134 ALLOW_ACCESSORS(harmony_restrictive_declarations); |
134 ALLOW_ACCESSORS(harmony_do_expressions); | 135 ALLOW_ACCESSORS(harmony_do_expressions); |
| 136 ALLOW_ACCESSORS(harmony_for_in); |
135 ALLOW_ACCESSORS(harmony_function_name); | 137 ALLOW_ACCESSORS(harmony_function_name); |
136 ALLOW_ACCESSORS(harmony_function_sent); | 138 ALLOW_ACCESSORS(harmony_function_sent); |
137 SCANNER_ACCESSORS(harmony_exponentiation_operator); | 139 SCANNER_ACCESSORS(harmony_exponentiation_operator); |
138 | 140 |
139 #undef SCANNER_ACCESSORS | 141 #undef SCANNER_ACCESSORS |
140 #undef ALLOW_ACCESSORS | 142 #undef ALLOW_ACCESSORS |
141 | 143 |
142 uintptr_t stack_limit() const { return stack_limit_; } | 144 uintptr_t stack_limit() const { return stack_limit_; } |
143 | 145 |
144 protected: | 146 protected: |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 Zone* zone_; | 918 Zone* zone_; |
917 | 919 |
918 Scanner* scanner_; | 920 Scanner* scanner_; |
919 bool stack_overflow_; | 921 bool stack_overflow_; |
920 | 922 |
921 bool allow_lazy_; | 923 bool allow_lazy_; |
922 bool allow_natives_; | 924 bool allow_natives_; |
923 bool allow_tailcalls_; | 925 bool allow_tailcalls_; |
924 bool allow_harmony_restrictive_declarations_; | 926 bool allow_harmony_restrictive_declarations_; |
925 bool allow_harmony_do_expressions_; | 927 bool allow_harmony_do_expressions_; |
| 928 bool allow_harmony_for_in_; |
926 bool allow_harmony_function_name_; | 929 bool allow_harmony_function_name_; |
927 bool allow_harmony_function_sent_; | 930 bool allow_harmony_function_sent_; |
928 }; | 931 }; |
929 | 932 |
930 template <class Traits> | 933 template <class Traits> |
931 ParserBase<Traits>::FunctionState::FunctionState( | 934 ParserBase<Traits>::FunctionState::FunctionState( |
932 FunctionState** function_state_stack, Scope** scope_stack, Scope* scope, | 935 FunctionState** function_state_stack, Scope** scope_stack, Scope* scope, |
933 FunctionKind kind, typename Traits::Type::Factory* factory) | 936 FunctionKind kind, typename Traits::Type::Factory* factory) |
934 : next_materialized_literal_index_(0), | 937 : next_materialized_literal_index_(0), |
935 expected_property_count_(0), | 938 expected_property_count_(0), |
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 has_seen_constructor_ = true; | 3115 has_seen_constructor_ = true; |
3113 return; | 3116 return; |
3114 } | 3117 } |
3115 } | 3118 } |
3116 | 3119 |
3117 | 3120 |
3118 } // namespace internal | 3121 } // namespace internal |
3119 } // namespace v8 | 3122 } // namespace v8 |
3120 | 3123 |
3121 #endif // V8_PARSING_PARSER_BASE_H | 3124 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |