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

Unified Diff: src/scopes.h

Issue 1053773006: [es6] implement default/optional parameters (WIP / comments) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Experimental not-quite-TDZ support Created 5 years, 8 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/preparser.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 7b372d9643fe4c1c07892139c6ecf1937ed1257e..12362959db4ada59ee3390dd248d0d8b7031f9db 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -87,6 +87,10 @@ class Scope: public ZoneObject {
scope_name_ = scope_name;
}
+ // Mark the current scope as a scope for evaluating function parameter
+ // expressions (such as initializers for optional parameters)
+ void SetParameterExpressionsScopeFor(Scope* function_scope);
+
void Initialize();
// Checks if the block scope is redundant, i.e. it does not contain any
@@ -125,7 +129,7 @@ class Scope: public ZoneObject {
// parameters the rightmost one 'wins'. However, the implementation
// expects all parameters to be declared and from left to right.
Variable* DeclareParameter(const AstRawString* name, VariableMode mode,
- bool is_rest = false);
+ ParameterKind kind = NormalParameter);
// Declare a local variable in this scope. If the variable has been
// declared before, the previously declared variable is returned.
@@ -509,6 +513,11 @@ class Scope: public ZoneObject {
// Scope tree.
Scope* outer_scope_; // the immediately enclosing outer scope, or NULL
+
+ // function scope to search for parameters. This auxiliary scope enables TDZ
+ // semantics for parameters while evaluating parameter expressions.
+ Scope* parameter_scope_;
+
ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes
// The scope type.
« no previous file with comments | « src/preparser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698