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

Unified Diff: src/variables.cc

Issue 1104223002: [es6] implement optional parameters via desugaring (with scoping) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a debugger test Created 5 years, 7 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/scopes.cc ('k') | test/mjsunit/harmony/optional-arguments.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/variables.cc
diff --git a/src/variables.cc b/src/variables.cc
index c0b8bd784353aa0ad349689b30ce7578de80e116..ffa82edcb7dd2af15935cf8099d7a434006ba111 100644
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -50,6 +50,15 @@ Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
is_used_(false),
initialization_flag_(initialization_flag),
maybe_assigned_(maybe_assigned_flag) {
+ if (scope && scope->is_function_body_scope()) {
+ // The function body is the proper declaration scope, however, the
+ // declaration is added to the outer scope in order to ensure allocation
+ // works correctly. Mark the scope as the outer scope here so that
+ // checking the declaration context works.
+ scope_ = scope->outer_scope();
+ DCHECK(scope_->is_function_scope());
+ }
+
// Var declared variables never need initialization.
DCHECK(!(mode == VAR && initialization_flag == kNeedsInitialization));
}
« no previous file with comments | « src/scopes.cc ('k') | test/mjsunit/harmony/optional-arguments.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698