DDC: "undefined" leaked by conditional return breaks default arguments value #36652
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
web-dev-compiler
We're running into some cases where, in DDC, a Dart function is returning
undefined
, and when that value is being passed into a function with conditional arguments, it's treating it as an unspecified argument.Reduced test case
Compiled DDC:
Here
fnWithConditionalReturn
is returningundefined
whenshouldReturn
isfalse
, causing theif (arg === void 0)
check to pass, even though the argument was specified.To help guard against other cases where undefined is leaked, could this instead check
arguments.length
? Or should most of those leaks get fixed instead?Also, tangentially related, is there a reason these parameters are initialized via separate statements, as opposed to in ES6 default parameter values?
The text was updated successfully, but these errors were encountered: