Index: src/scopes.h |
diff --git a/src/scopes.h b/src/scopes.h |
index 186530ceab2ef134b2384ef32e5b9b588ecc182e..8996b50009873625b8a2186383b23b0717a0c9e2 100644 |
--- a/src/scopes.h |
+++ b/src/scopes.h |
@@ -73,7 +73,8 @@ class Scope: public ZoneObject { |
// Construction |
Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type, |
- AstValueFactory* value_factory); |
+ AstValueFactory* value_factory, |
+ FunctionKind function_kind = kNormalFunction); |
// Compute top scope and allocate variables. For lazy compilation the top |
// scope only contains the single lazily compiled function, so this |
@@ -88,7 +89,7 @@ class Scope: public ZoneObject { |
scope_name_ = scope_name; |
} |
- void Initialize(bool subclass_constructor = false); |
+ void Initialize(); |
// Checks if the block scope is redundant, i.e. it does not contain any |
// block scoped declarations. In that case it is removed from the scope |
@@ -281,6 +282,10 @@ class Scope: public ZoneObject { |
bool is_block_scope() const { return scope_type_ == BLOCK_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() { block_scope_is_class_scope_ = true; } |
arv (Not doing code reviews)
2015/03/06 16:37:24
DCHECK(is_block_scope());
marja
2015/03/09 10:01:38
Done.
|
+ bool is_class_scope() const { |
+ 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(); |
@@ -332,6 +337,8 @@ class Scope: public ZoneObject { |
// The type of this scope. |
ScopeType scope_type() const { return scope_type_; } |
+ FunctionKind function_kind() const { return function_kind_; } |
+ |
// The language mode of this scope. |
LanguageMode language_mode() const { return language_mode_; } |
@@ -501,6 +508,10 @@ class Scope: public ZoneObject { |
// The scope type. |
ScopeType scope_type_; |
+ // Some block scopes are tagged as class scopes. |
+ bool block_scope_is_class_scope_; |
+ // If the scope is a function scope, this is the function kind. |
+ FunctionKind function_kind_; |
// Debugging support. |
const AstRawString* scope_name_; |
@@ -658,6 +669,8 @@ class Scope: public ZoneObject { |
bool ResolveVariablesRecursively(CompilationInfo* info, |
AstNodeFactory* factory); |
+ bool CheckStrongModeDeclaration(VariableProxy* proxy, Variable* var); |
+ |
// Scope analysis. |
void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); |
bool HasTrivialContext() const; |
@@ -703,9 +716,13 @@ class Scope: public ZoneObject { |
} |
} |
- void SetDefaults(ScopeType type, |
- Scope* outer_scope, |
- Handle<ScopeInfo> scope_info); |
+ void SetDefaults(ScopeType type, Scope* outer_scope, |
+ Handle<ScopeInfo> scope_info, |
+ FunctionKind function_kind = kNormalFunction); |
+ |
+ // If this scope is a method scope of a class, return the corresponding |
+ // class variable, otherwise nullptr. |
+ Variable* ClassVariableForMethod() const; |
AstValueFactory* ast_value_factory_; |
Zone* zone_; |