Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.2
Description
In ECMAScript, default function arguments are placed in their own environment record, which then acts as the parent scope for the function body. That means that
console.log((function() { let a = 1; function f(fn = function(){ return a; }){ const a = 2; return fn() } return f(); })())
should print 1. However, in QML, it will print 2 because fn ends up in the scope of f's body, and thus uses the a from there instead of from the outer scope.
Attachments
Issue Links
- relates to
-
QTBUG-104751 Can't have type annotations and default arguments
-
- Open
-
- resulted from
-
QTBUG-98032 QML/Javascript: Using an anonymous function as a default parameter in a function signature crashes the application.
-
- Closed
-