| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 ALLOW_ACCESSORS(harmony_computed_property_names); | 123 ALLOW_ACCESSORS(harmony_computed_property_names); |
| 124 ALLOW_ACCESSORS(harmony_rest_parameters); | 124 ALLOW_ACCESSORS(harmony_rest_parameters); |
| 125 ALLOW_ACCESSORS(harmony_spreadcalls); | 125 ALLOW_ACCESSORS(harmony_spreadcalls); |
| 126 ALLOW_ACCESSORS(harmony_destructuring); | 126 ALLOW_ACCESSORS(harmony_destructuring); |
| 127 ALLOW_ACCESSORS(harmony_spread_arrays); | 127 ALLOW_ACCESSORS(harmony_spread_arrays); |
| 128 ALLOW_ACCESSORS(harmony_new_target); | 128 ALLOW_ACCESSORS(harmony_new_target); |
| 129 ALLOW_ACCESSORS(strong_mode); | 129 ALLOW_ACCESSORS(strong_mode); |
| 130 ALLOW_ACCESSORS(legacy_const); | 130 ALLOW_ACCESSORS(legacy_const); |
| 131 #undef ALLOW_ACCESSORS | 131 #undef ALLOW_ACCESSORS |
| 132 | 132 |
| 133 bool allow_harmony_modules() const { return scanner()->HarmonyModules(); } | |
| 134 bool allow_harmony_unicode() const { return scanner()->HarmonyUnicode(); } | 133 bool allow_harmony_unicode() const { return scanner()->HarmonyUnicode(); } |
| 135 | 134 |
| 136 void set_allow_harmony_modules(bool a) { scanner()->SetHarmonyModules(a); } | |
| 137 void set_allow_harmony_unicode(bool a) { scanner()->SetHarmonyUnicode(a); } | 135 void set_allow_harmony_unicode(bool a) { scanner()->SetHarmonyUnicode(a); } |
| 138 | 136 |
| 139 protected: | 137 protected: |
| 140 enum AllowRestrictedIdentifiers { | 138 enum AllowRestrictedIdentifiers { |
| 141 kAllowRestrictedIdentifiers, | 139 kAllowRestrictedIdentifiers, |
| 142 kDontAllowRestrictedIdentifiers | 140 kDontAllowRestrictedIdentifiers |
| 143 }; | 141 }; |
| 144 | 142 |
| 145 enum Mode { | 143 enum Mode { |
| 146 PARSE_LAZILY, | 144 PARSE_LAZILY, |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 304 |
| 307 Scope* NewScope(Scope* parent, ScopeType scope_type) { | 305 Scope* NewScope(Scope* parent, ScopeType scope_type) { |
| 308 // Must always pass the function kind for FUNCTION_SCOPE and ARROW_SCOPE. | 306 // Must always pass the function kind for FUNCTION_SCOPE and ARROW_SCOPE. |
| 309 DCHECK(scope_type != FUNCTION_SCOPE); | 307 DCHECK(scope_type != FUNCTION_SCOPE); |
| 310 DCHECK(scope_type != ARROW_SCOPE); | 308 DCHECK(scope_type != ARROW_SCOPE); |
| 311 return NewScope(parent, scope_type, kNormalFunction); | 309 return NewScope(parent, scope_type, kNormalFunction); |
| 312 } | 310 } |
| 313 | 311 |
| 314 Scope* NewScope(Scope* parent, ScopeType scope_type, FunctionKind kind) { | 312 Scope* NewScope(Scope* parent, ScopeType scope_type, FunctionKind kind) { |
| 315 DCHECK(ast_value_factory()); | 313 DCHECK(ast_value_factory()); |
| 316 DCHECK(scope_type != MODULE_SCOPE || allow_harmony_modules()); | 314 DCHECK(scope_type != MODULE_SCOPE || FLAG_harmony_modules); |
| 317 DCHECK(!IsArrowFunction(kind) || scope_type == ARROW_SCOPE); | 315 DCHECK(!IsArrowFunction(kind) || scope_type == ARROW_SCOPE); |
| 318 Scope* result = new (zone()) | 316 Scope* result = new (zone()) |
| 319 Scope(zone(), parent, scope_type, ast_value_factory(), kind); | 317 Scope(zone(), parent, scope_type, ast_value_factory(), kind); |
| 320 result->Initialize(); | 318 result->Initialize(); |
| 321 return result; | 319 return result; |
| 322 } | 320 } |
| 323 | 321 |
| 324 Scanner* scanner() const { return scanner_; } | 322 Scanner* scanner() const { return scanner_; } |
| 325 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } | 323 AstValueFactory* ast_value_factory() const { return ast_value_factory_; } |
| 326 int position() { return scanner_->location().beg_pos; } | 324 int position() { return scanner_->location().beg_pos; } |
| (...skipping 3685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4012 *ok = false; | 4010 *ok = false; |
| 4013 return; | 4011 return; |
| 4014 } | 4012 } |
| 4015 has_seen_constructor_ = true; | 4013 has_seen_constructor_ = true; |
| 4016 return; | 4014 return; |
| 4017 } | 4015 } |
| 4018 } | 4016 } |
| 4019 } } // v8::internal | 4017 } } // v8::internal |
| 4020 | 4018 |
| 4021 #endif // V8_PREPARSER_H | 4019 #endif // V8_PREPARSER_H |
| OLD | NEW |