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_AST_SCOPES_H_ | 5 #ifndef V8_AST_SCOPES_H_ |
6 #define V8_AST_SCOPES_H_ | 6 #define V8_AST_SCOPES_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // Is this scope inside a with statement. | 324 // Is this scope inside a with statement. |
325 bool inside_with() const { return scope_inside_with_; } | 325 bool inside_with() const { return scope_inside_with_; } |
326 | 326 |
327 // Does this scope access "super" property (super.foo). | 327 // Does this scope access "super" property (super.foo). |
328 bool uses_super_property() const { return scope_uses_super_property_; } | 328 bool uses_super_property() const { return scope_uses_super_property_; } |
329 // Does this scope have the potential to execute declarations non-linearly? | 329 // Does this scope have the potential to execute declarations non-linearly? |
330 bool is_nonlinear() const { return scope_nonlinear_; } | 330 bool is_nonlinear() const { return scope_nonlinear_; } |
331 | 331 |
332 // Whether this needs to be represented by a runtime context. | 332 // Whether this needs to be represented by a runtime context. |
333 bool NeedsContext() const { | 333 bool NeedsContext() const { |
334 // Catch and module scopes always have heap slots. | 334 // Catch scopes always have heap slots. |
335 DCHECK(!is_catch_scope() || num_heap_slots() > 0); | 335 DCHECK(!is_catch_scope() || num_heap_slots() > 0); |
336 DCHECK(!is_module_scope() || num_heap_slots() > 0); | 336 return num_heap_slots() > 0; |
337 return is_with_scope() || num_heap_slots() > 0; | |
338 } | 337 } |
339 | 338 |
340 // --------------------------------------------------------------------------- | 339 // --------------------------------------------------------------------------- |
341 // Accessors. | 340 // Accessors. |
342 | 341 |
343 // The type of this scope. | 342 // The type of this scope. |
344 ScopeType scope_type() const { return scope_type_; } | 343 ScopeType scope_type() const { return scope_type_; } |
345 | 344 |
346 // The language mode of this scope. | 345 // The language mode of this scope. |
347 LanguageMode language_mode() const { return language_mode_; } | 346 LanguageMode language_mode() const { return language_mode_; } |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 // Convenience variable; Subclass constructor only | 896 // Convenience variable; Subclass constructor only |
898 Variable* this_function_; | 897 Variable* this_function_; |
899 // Module descriptor; module scopes only. | 898 // Module descriptor; module scopes only. |
900 ModuleDescriptor* module_descriptor_; | 899 ModuleDescriptor* module_descriptor_; |
901 }; | 900 }; |
902 | 901 |
903 } // namespace internal | 902 } // namespace internal |
904 } // namespace v8 | 903 } // namespace v8 |
905 | 904 |
906 #endif // V8_AST_SCOPES_H_ | 905 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |