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

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: 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 5e3dc1f0654bf65c3ee738665fcb7bf2107be63b..5cb362600dc7356067bde5aa6025b08ee7842690 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);
+ int pos, bool is_rest, bool* is_duplicate);
arv (Not doing code reviews) 2015/05/06 20:32:38 keep pos at end for consistency
caitp (gmail) 2015/05/06 20:42:55 Acknowledged.
// 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,
@@ -365,6 +367,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();
@@ -544,6 +551,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