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

Unified Diff: src/ast/scopes.cc

Issue 2472063002: Preparse lazy function parameters (Closed)
Patch Set: IsArrowFunction Created 4 years, 1 month 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 | « no previous file | src/ast/variables.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index 6e366b014c234d983e58a811a0ae652a3ee5e277..7e84ba6ccf718f252d62de51cf00a60bccd323d2 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -1252,6 +1252,7 @@ void DeclarationScope::ResetAfterPreparsing(AstValueFactory* ast_value_factory,
DCHECK(is_function_scope());
// Reset all non-trivial members.
+ params_.Clear();
decls_.Clear();
locals_.Clear();
sloppy_block_function_map_.Clear();
@@ -1260,28 +1261,8 @@ void DeclarationScope::ResetAfterPreparsing(AstValueFactory* ast_value_factory,
inner_scope_ = nullptr;
unresolved_ = nullptr;
- // TODO(verwaest): We should properly preparse the parameters (no declarations
- // should be created), and reparse on abort.
- if (aborted) {
- if (!IsArrowFunction(function_kind_)) {
- DeclareDefaultFunctionVariables(ast_value_factory);
- }
- // Recreate declarations for parameters.
- for (int i = 0; i < params_.length(); i++) {
- Variable* var = params_[i];
- if (var->mode() == TEMPORARY) {
- // TODO(verwaest): Remove and unfriend DeclarationScope from Variable.
- *var->next() = nullptr;
- locals_.Add(var);
- } else if (variables_.Lookup(var->raw_name()) == nullptr) {
- // TODO(verwaest): Remove and unfriend DeclarationScope from Variable.
- *var->next() = nullptr;
- variables_.Add(zone(), var);
- locals_.Add(var);
- }
- }
- } else {
- params_.Rewind(0);
+ if (aborted && !IsArrowFunction(function_kind_)) {
+ DeclareDefaultFunctionVariables(ast_value_factory);
}
#ifdef DEBUG
« no previous file with comments | « no previous file | src/ast/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698