ReferenceError on setting paramater to default parameter of same name
Reported by
rschako...@gmail.com,
Apr 7 2017
|
|||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36 Steps to reproduce the problem: 1. Declare function with identical param and default param name 2. Call function What is the expected behavior? Works as expected in Firefox. What went wrong? Throws that the identifier is undefined, even if previously declared and/or set explicitly. Applies to functions, arrow functions, and class/object methods. Did this work before? N/A Chrome version: 57.0.2987.133 Channel: stable OS Version: 16.04 Flash Version: var pos = 10 foo = (p = pos) => p // OK bar = (pos = pos) => pos // ReferenceError console.log(foo()) console.log(bar())
,
Apr 10 2017
,
Apr 12 2017
rschakotay@ - Thanks for filing the issue...!! Could you please provide a sample html file, expected and actual behavior to test this issue from TE-end. This will help us in triaging the issue further. Thanks...!!
,
Apr 12 2017
in Chrome 58 both of them throw the error. I suppose this is expected?
,
Apr 12 2017
This is working as intended. The "pos = pos" case fails because the "pos" on the right-hand side refers to the "pos" parameter name, but reading from it fails, because it's not yet been initialized. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by rschako...@gmail.com
, Apr 7 2017