diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-06-09 01:48:29 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:30 -0400 |
commit | d27591806950034d8d3763a13db6f2c201311991 (patch) | |
tree | ea9b9ec96274ab9d3f0fd48670dc9b1876fdd889 /js/src/vm | |
parent | d200a2b02e50b33511ff2ea26a2968301f06b170 (diff) | |
download | uxp-d27591806950034d8d3763a13db6f2c201311991.tar.gz |
1339137 - Don't do Annex B lexical function behavior when redeclaring a parameter name in a function with parameter expressions.
Diffstat (limited to 'js/src/vm')
-rw-r--r-- | js/src/vm/Scope.cpp | 8 | ||||
-rw-r--r-- | js/src/vm/Scope.h | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/js/src/vm/Scope.cpp b/js/src/vm/Scope.cpp index a71c036959..0f80d7b691 100644 --- a/js/src/vm/Scope.cpp +++ b/js/src/vm/Scope.cpp @@ -669,6 +669,14 @@ FunctionScope::script() const return canonicalFunction()->nonLazyScript(); } +/* static */ bool +FunctionScope::isSpecialName(ExclusiveContext* cx, JSAtom* name) +{ + return name == cx->names().arguments || + name == cx->names().dotThis || + name == cx->names().dotGenerator; +} + /* static */ Shape* FunctionScope::getEmptyEnvironmentShape(ExclusiveContext* cx, bool hasParameterExprs) { diff --git a/js/src/vm/Scope.h b/js/src/vm/Scope.h index 1d04fd9f66..4a4ae80908 100644 --- a/js/src/vm/Scope.h +++ b/js/src/vm/Scope.h @@ -446,10 +446,11 @@ Scope::is<LexicalScope>() const } // -// Scope corresponding to a function. Holds formal parameter names and, if the -// function parameters contain no expressions that might possibly be -// evaluated, the function's var bindings. For example, in these functions, -// the FunctionScope will store a/b/c bindings but not d/e/f bindings: +// Scope corresponding to a function. Holds formal parameter names, special +// internal names (see FunctionScope::isSpecialName), and, if the function +// parameters contain no expressions that might possibly be evaluated, the +// function's var bindings. For example, in these functions, the FunctionScope +// will store a/b/c bindings but not d/e/f bindings: // // function f1(a, b) { // var cÍž @@ -562,6 +563,8 @@ class FunctionScope : public Scope return data().nonPositionalFormalStart; } + static bool isSpecialName(ExclusiveContext* cx, JSAtom* name); + static Shape* getEmptyEnvironmentShape(ExclusiveContext* cx, bool hasParameterExprs); }; |