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

Unified Diff: src/scopes.h

Issue 1127063003: [es6] implement default parameters via desugaring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: arv's comments 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
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index 7a013e96c7ffd63aa9ceb4073a7cf7a3e044a467..72055a3225b86290a5c91ccab776ea2067f8fd87 100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -126,7 +126,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, bool* is_duplicate);
+ bool is_rest, bool* is_duplicate, int pos);
// Declare a local variable in this scope. If the variable has been
// declared before, the previously declared variable is returned.
@@ -141,6 +141,8 @@ class Scope: public ZoneObject {
// with statements or eval calls.
Variable* DeclareDynamicGlobal(const AstRawString* name);
+ void ShadowParametersForExpressions();
+
// Create a new unresolved variable.
VariableProxy* NewUnresolved(AstNodeFactory* factory,
const AstRawString* name,
@@ -366,6 +368,11 @@ class Scope: public ZoneObject {
return params_[index];
}
+ int parameter_position(int index) const {
+ DCHECK(is_function_scope());
+ return param_positions_[index];
+ }
+
// Returns the default function arity --- does not include rest parameters.
int default_function_length() const {
int count = params_.length();
@@ -545,6 +552,7 @@ class Scope: public ZoneObject {
ZoneList<Variable*> temps_;
// Parameter list in source order.
ZoneList<Variable*> params_;
+ ZoneList<int> param_positions_;
// Variables that must be looked up dynamically.
DynamicScopePart* dynamics_;
// Unresolved variables referred to from this scope.

Powered by Google App Engine
This is Rietveld 408576698