| Index: src/scopes.h
|
| diff --git a/src/scopes.h b/src/scopes.h
|
| index 5e3dc1f0654bf65c3ee738665fcb7bf2107be63b..2220d9167199f03fe07d3097fc6e0a93d0161131 100644
|
| --- a/src/scopes.h
|
| +++ b/src/scopes.h
|
| @@ -87,7 +87,7 @@ class Scope: public ZoneObject {
|
| void SetScopeName(const AstRawString* scope_name) {
|
| scope_name_ = scope_name;
|
| }
|
| -
|
| + const AstRawString* scope_name() const { return scope_name_; }
|
| void Initialize();
|
|
|
| // Checks if the block scope is redundant, i.e. it does not contain any
|
| @@ -276,10 +276,15 @@ class Scope: public ZoneObject {
|
| bool is_function_scope() const {
|
| return scope_type_ == FUNCTION_SCOPE || scope_type_ == ARROW_SCOPE;
|
| }
|
| + bool is_function_body_scope() const {
|
| + return scope_type_ == FUNCTION_BODY_SCOPE;
|
| + }
|
| bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; }
|
| bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; }
|
| bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; }
|
| - bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; }
|
| + bool is_block_scope() const {
|
| + return scope_type_ == BLOCK_SCOPE || scope_type_ == FUNCTION_BODY_SCOPE;
|
| + }
|
| bool is_with_scope() const { return scope_type_ == WITH_SCOPE; }
|
| bool is_arrow_scope() const { return scope_type_ == ARROW_SCOPE; }
|
| void tag_as_class_scope() {
|
| @@ -290,8 +295,8 @@ class Scope: public ZoneObject {
|
| return is_block_scope() && block_scope_is_class_scope_;
|
| }
|
| bool is_declaration_scope() const {
|
| - return is_eval_scope() || is_function_scope() ||
|
| - is_module_scope() || is_script_scope();
|
| + return is_eval_scope() || is_function_scope() || is_module_scope() ||
|
| + is_script_scope() || is_function_body_scope();
|
| }
|
| bool is_strict_eval_scope() const {
|
| return is_eval_scope() && is_strict(language_mode_);
|
| @@ -410,6 +415,9 @@ class Scope: public ZoneObject {
|
| // The scope immediately surrounding this scope, or NULL.
|
| Scope* outer_scope() const { return outer_scope_; }
|
|
|
| + // The inner scope which contains the main "body" of a function (may be null)
|
| + Scope* function_body() const { return function_body_; }
|
| +
|
| // The ModuleDescriptor for this scope; only for module scopes.
|
| ModuleDescriptor* module() const { return module_descriptor_; }
|
|
|
| @@ -521,6 +529,7 @@ class Scope: public ZoneObject {
|
| // Scope tree.
|
| Scope* outer_scope_; // the immediately enclosing outer scope, or NULL
|
| ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes
|
| + Scope* function_body_; // The scope for a function body
|
|
|
| // The scope type.
|
| ScopeType scope_type_;
|
|
|