Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.2
-
None
-
Qt 5.13 git master on Linux
-
-
2fa1c92cb7e60f89e200eff48cf7e76d8d2febe6 (qt/qtdeclarative/5.12)
Description
When including a JavaScript file from another JavaScript file using Qt.include it fails to register any functions that use reserved keywords that were reserved for future use in ECMAScript 1-3 such as double and char, but are no longer reserved in ECMAScript 5.
Consider the following main.qml
import QtQml 2.0 import "test.js" as Test QtObject { }
with the following test.js
Qt.include("someotherfile.js"); foo("bar");
Now, in someotherfile.js define a function foo which takes an argument named with a "reserved" keyword, such as char
function foo(char) { return true; }
Trying to call this function will result in an error
ReferenceError: foo is not defined
. If you name theĀ function argument differently, e.g. charr it works fine.
You also cannot name the function itself char or double or something like this.
When importing the file from QML directly using import "someotherfile.js" as SomeOtherFile the method can be called just fine via SomeOtherFile.foo("bar"), so this bug only affects Qt.import statement