You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a default function parameter that refers to a variable, and then you shadow that same variable inside the same function, then Terser confuses the outer variable with the inner one and ends up pointing the default parameter to the inner variable which is not actually in scope yet.
To make that clearer: in the example below database is defined outside of query; the query function has a db parameter which defaults to that outer database variable. Then query defines its owndatabase variable that it accesses the value through.
Bug report or Feature request?
Bug report
If you have a default function parameter that refers to a variable, and then you shadow that same variable inside the same function, then Terser confuses the outer variable with the inner one and ends up pointing the default parameter to the inner variable which is not actually in scope yet.
To make that clearer: in the example below
database
is defined outside ofquery
; thequery
function has adb
parameter which defaults to that outerdatabase
variable. Thenquery
defines its owndatabase
variable that it accesses the value through.terser
inputterser
output or errorYou can see that
query(a=e)
means its defaulting to thee
variable within thequery
functionExpected result
but thats incorrect, it should be defaulting to the outer
database
value.The text was updated successfully, but these errors were encountered: