Index: src/scopes.h |
diff --git a/src/scopes.h b/src/scopes.h |
index 01df8f9d77e2d355a3ab8b17a8f7b85d5cd31990..fbbf35b9aa3552ffd59f25ddd689872e1a85bff5 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. |
@@ -373,6 +373,13 @@ class Scope: public ZoneObject { |
return params_[index]; |
} |
+ // TODO(caitp): This probably won't work when BindingPatterns are supported |
+ // in function parameters. Need a better way. |
+ 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(); |
@@ -553,6 +560,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. |