Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: src/scopes.h

Issue 968263002: [strong] Fix scoping related errors for methods. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: code review (arv, rossberg) Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/scopeinfo.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 186530ceab2ef134b2384ef32e5b9b588ecc182e..284386d854749e375f2b5ad6751fe57ff6a8b73f 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,13 @@ 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() {
+ DCHECK(is_block_scope());
+ block_scope_is_class_scope_ = true;
+ }
+ 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 +340,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 +511,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 +672,12 @@ class Scope: public ZoneObject {
bool ResolveVariablesRecursively(CompilationInfo* info,
AstNodeFactory* factory);
+ bool CheckStrongModeDeclaration(VariableProxy* proxy, Variable* var);
+
+ // If this scope is a method scope of a class, return the corresponding
+ // class variable, otherwise nullptr.
+ Variable* ClassVariableForMethod() const;
+
// Scope analysis.
void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval);
bool HasTrivialContext() const;
@@ -703,9 +723,9 @@ 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);
AstValueFactory* ast_value_factory_;
Zone* zone_;
« no previous file with comments | « src/scopeinfo.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698