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

Unified Diff: src/parsing/parser-base.h

Issue 2160943004: Remove ast_value_factory_ and usages from scope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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/parsing/parser.cc ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 4a40ce85d903e526da52c5e4c369246f56df8744..7ea45a6c861f9854521b4f0615a93165a01ccda9 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -618,14 +618,21 @@ class ParserBase : public Traits {
Scope* NewScope(Scope* parent, ScopeType scope_type) {
// Must always pass the function kind for FUNCTION_SCOPE.
DCHECK(scope_type != FUNCTION_SCOPE);
- return NewScope(parent, scope_type, kNormalFunction);
+ Scope* result =
+ new (zone()) Scope(zone(), parent, scope_type, kNormalFunction);
+ result->Initialize();
+ if (scope_type == MODULE_SCOPE) result->DeclareThis(ast_value_factory());
+ return result;
}
- Scope* NewScope(Scope* parent, ScopeType scope_type, FunctionKind kind) {
+ Scope* NewScope(Scope* parent, FunctionKind kind) {
adamk 2016/07/19 20:49:43 Seems like calling this "NewFunctionScope" would m
DCHECK(ast_value_factory());
- Scope* result = new (zone())
- Scope(zone(), parent, scope_type, ast_value_factory(), kind);
+ Scope* result = new (zone()) Scope(zone(), parent, FUNCTION_SCOPE, kind);
result->Initialize();
+ if (!IsArrowFunction(kind)) {
+ result->DeclareThis(ast_value_factory());
+ result->DeclareDefaultFunctionVariables(ast_value_factory());
+ }
return result;
}
@@ -2307,7 +2314,7 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN,
ValidateFormalParameterInitializer(&arrow_formals_classifier, ok);
Scanner::Location loc(lhs_beg_pos, scanner()->location().end_pos);
- Scope* scope = this->NewScope(this->scope(), FUNCTION_SCOPE,
+ Scope* scope = this->NewScope(this->scope(),
is_async ? FunctionKind::kAsyncArrowFunction
: FunctionKind::kArrowFunction);
// Because the arrow's parameters were parsed in the outer scope, any
« no previous file with comments | « src/parsing/parser.cc ('k') | src/parsing/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698