Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
5.4.0
Description
Using Javascript in an QML application and retrieving the function code as string stopped working:
function test(parameter) { console.log("Something to do!"); } ... function otherFunction(otherParam) { console.log("Output: "+test.toString()); }
All this does is to print the following:
"Output: function() { [code] }"
instead of the desired string:
"Output: function() { console.log("Something to do!"); }"
According to 5th edition of ECMA-262 , section 15.3.4.2, Function.prototype.toString() should return an implementation-defined rendition having a syntax of FunctionDeclaration. So perhaps Qt's JS engine here exhibits nonstandard behavior (c.f. Stack Overflow answer ).
Attachments
Issue Links
- is required for
-
QBS-913 QtScript dependency needs to be removed
- Closed