Description[es6] Scoping & initialization for var shadowing non-simple parameters
Var-bindings may shadow parameters from a non-simple parameter list. When that happens: they create separate bindings, but are initialised with the respective parameter value. Thus:
(function(x, f = () => x) { var x; var y = x; x = 2; return [x, y, f()] })(1) --> [2, 1, 1]
This CL implements that by inserting a suitable assignment for every shadwowing var-variable (e.g., x = outer_x above) at the beginning of the function's body block.
R=adamk@chromium.org
BUG=v8:4440, v8:811
LOG=N
Committed: https://crrev.com/2c2848dccf697830dab75f59a2b7a72af48cbc48
Cr-Commit-Position: refs/heads/master@{#31042}
Patch Set 1 #Patch Set 2 : Handle function decls correctly #
Total comments: 10
Patch Set 3 : Comments #
Messages
Total messages: 16 (4 generated)
|