aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage
Commit message (Collapse)AuthorAgeFilesLines
* Split CompiledData::CompilationUnit in twoUlf Hermann2019-05-163-15/+15
| | | | | | | | We need a CompilationUnit that only holds the data needed for compilation and another one that is executable by the runtime. Change-Id: I704d859ba028576a18460f5e3a59f210f64535d3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Register QObject along with QQmlComponent as basic type of the languageUlf Hermann2019-05-083-0/+8
| | | | | | | | | | | | | Apparently we need it somewhere. Before the restructuring of imports all QtQml types were automatically registered on QQmlEnginePrivate::init(). We don't do this anymore, so we need to register the basic building blocks of the language separately now. Fixes: QTBUG-75645 Change-Id: I77fe23f709304586cd16986650b0056ea87bcd45 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-292-0/+30
|\ | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compilercontext.cpp src/qml/qml/qqmlmetatype.cpp Change-Id: I02e0216961b92ff68a3f91a70edc33fe9e8db147
| * Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-272-0/+30
| |\ | | | | | | | | | Change-Id: I552629813ea8100d04ea19e51fe7198931082e19
| | * Allow creation of variants from non-singleton QQmlTypeWrappersUlf Hermann2019-04-262-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | I don't see any reason why this should be prohibited. Change-Id: I4a54c55eff4b9151691d0587627efad4a06485f1 Fixes: QTBUG-74815 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-04-188-2/+19
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlimport.cpp Change-Id: I6add6267297ea50a646d43d212027a168dca8916
| * | Improve error messageRainer Keller2019-04-171-1/+1
| | | | | | | | | | | | | | | Change-Id: I1f7f0781521757f5412b50680203698e33bd9d23 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-04-175-1/+11
| |\| | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/qml/qv4assembler/tst_qv4assembler.cpp Change-Id: I9d31c982881a617099354bf8acceb76332f11496
| | * QML: Allow fetchOrCreateTypeForUrl to report errors without qFatalErik Verbruggen2019-04-163-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | Because qFatal will abort() the program. Task-number: QTBUG-71116 Change-Id: Ifd6be996cfbd6fff8e75ad2b26682c34f837ac88 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| | * QML: Check for (valid) compilation units while hashingErik Verbruggen2019-04-163-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | When an error occurred while creating a compilation unit, the pointer might be set to null. Subsequent use in hashing should check for this, and not use a nullptr. Change-Id: I62650917a740c9c1be29608285670153bed8703c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
| * | Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta3Qt Forward Merge Bot2019-04-153-0/+7
| |\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/masm/assembler/LinkBuffer.h src/qmltest/doc/src/qtquicktest-index.qdoc tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp Change-Id: I7d83ad95cf489dda794dd7a0a33bad3ef3b05609
| | * Detect and reject cyclic aliasesUlf Hermann2019-04-093-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Previously those would result in infinite recursion. Fixes: QTBUG-74867 Change-Id: I6c0043b43e72fe7bc3a2a139ca600af2d5bca5ad Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix deprecation warnings about QVariant APIFriedemann Kleint2019-04-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warnings like: sruntime/qv4serialize.cpp:378:45: warning: 'QVariant qVariantFromValue(const T&) [with T = QQmlListModelWorkerAgent::VariantRef]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] qml/qqmlvmemetaobject.cpp:597:61: warning: 'QVariant qVariantFromValue(const T&) [with T = QList<QObject*>]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] jsruntime/qv4engine.cpp:1319:66: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] jsruntime/qv4engine.cpp:1350:60: warning: 'QVariant qVariantFromValue(const T&) [with T = QList<QObject*>]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickitem.cpp:8396:78: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickitem.cpp:8693:80: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickgenericshadereffect.cpp:126:69: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickgenericshadereffect.cpp:127:55: warning: 'QVariant qVariantFromValue(const T&) [with T = QSize]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickopenglshadereffect.cpp:713:69: warning: 'QVariant qVariantFromValue(const T&) [with T = QObject*]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] items/qquickopenglshadereffect.cpp:714:55: warning: 'QVariant qVariantFromValue(const T&) [with T = QSize]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] qquickcustomparticle.cpp:416:89: warning: 'QVariant qVariantFromValue(const T&) [with T = double]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] qqmlenginedebugclient.cpp:403:47: warning: 'QVariant qVariantFromValue(const T&) [with T = QQmlEngineDebugObjectReference]' is deprecated: Use QVariant::fromValue() instead. [-Wdeprecated-declarations] Task-number: QTBUG-74043 Change-Id: I14cb7d7c1fb8dc6321e32208a7de15f6bdb19065 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into HEADUlf Hermann2019-03-224-0/+56
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4compileddata_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4jithelpers.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4runtimeapi_p.h src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/qqmltypemodule_p.h Change-Id: If28793e9e08418457a11fc2c5832f03cab2fcc76
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-03-214-0/+56
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qv4bytecodehandler.cpp src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4compiler.cpp src/qml/compiler/qv4instr_moth.cpp src/qml/compiler/qv4instr_moth_p.h src/qml/jit/qv4baselinejit.cpp src/qml/jit/qv4baselinejit_p.h src/qml/jsruntime/qv4function.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I8fb4d6f19677bcec0a4593b250f2eda5ae85e3d2
| | * Add test for dynamic anchors to parents in PropertyChangesUlf Hermann2019-03-203-0/+41
| | | | | | | | | | | | | | | | | | Fixes: QTBUG-71042 Change-Id: I4d0927b0d6c9a4ccaaddfbfd6dd2a7841fbbc845 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| | * Implement dummy QML lookups for "global" variablesSimon Hausmann2019-03-202-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When resolving names in the context of QML bindings, we now direct runtime access to QQmlContextWrapper::resolveQmlPropertyLookupGetter. At the moment this does basically the same as Runtime::method_loadName, which we called earlier. However this now provides the opportunity to optimize lookups in the QML context in a central place. When performing a call on a scope or context object property, we also did not use a CallName() instruction - which would have gotten the thisObject wrong - but instead we use a dedicated CallScopeObjectProperty and CallContextObjectProperty instruction. These rely on identifying these properties at compile time, which goes away with lookups (and also doesn't work when using ahead-of-time compilation). Therefore the qml context property lookup is using a getPropertyAndBase style signature and Runtime::method_callQmlContextPropertyLookup uses that. For the tests to pass, some error expectations need adjusting. In particular the compile-time detection of write attempts to id objects is now delayed to the run-time. The old code path is still there and will be removed separately in the next commit (as it is massive). Task-number: QTBUG-69898 Change-Id: Iad1ff93d3758c4db984a7c2d003beee21ed2275c Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-02-254-15/+5
|\| | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/qml/qqmlmetatype.cpp Change-Id: I517c001ea4eb0fdd8e469f9fffe5b7559a5b0795
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Liang Qi2019-02-221-12/+2
| |\| | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/quick/qquicktableview/tst_qquicktableview.cpp Change-Id: If3bf1abc23a59c458be0bb862d92f2edcb16b79f
| | * Only warn about incompatible parameter types passed from QMLUlf Hermann2019-02-211-12/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Throwing a TypeError is too drastic. We need to properly deprecate this pattern before we actually enforce the compatibility. Fixes: QTBUG-73943 Change-Id: I00313ad7aed4021a7368fd014e2bfc6443b177e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * | Only generate a warning when assigning null to incompatible propertiesUlf Hermann2019-02-223-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Such code used to work before and we should not break it without a proper deprecation procedure. Change-Id: I049caf6ae5cc06aa796b19eda858612935b8d674 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-02-211-2/+12
|\| | | | | | | | | | | Change-Id: Ie33d1c736992abcbde6568131374a7a7891f965c
| * | Merge remote-tracking branch 'origin/5.12' into 5.13Qt Forward Merge Bot2019-02-201-2/+12
| |\| | | | | | | | | | Change-Id: I69c3e6610ff590d9c18f386fc17ed2e429b58d26
| | * Check parameter types when invoking C++ functions from QMLUlf Hermann2019-02-171-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now check if the given parameters can be converted to the expected arguments of the function being invoked and throw a type error if not. Previously we would still invoke the method with random parameters. [ChangeLog][QtQml][Important Behavior Changes] The parameters passed to C++ functions from QML are now checked for compatibility with the expected arguments. If they cannot be converted, a type error is thrown in JavaScript and the function is not invoked. Fixes: QTBUG-73405 Change-Id: If16089510d314bb7cdb7d4db86478114c61281a8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-02-082-2/+2
|\| | | | | | | | | | | Change-Id: I92e477524c95cceed61882e494e478eb1f8991ce
| * | Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-alpha1Qt Forward Merge Bot2019-02-072-2/+2
| |\| | | | | | | | | | Change-Id: I5209d833e171c795556c075e2a5f964b59b6df2e
| | * Improve error messageRainer Keller2019-02-042-2/+2
| | | | | | | | | | | | | | | | | | | | | Show more datails about what actually went wrong. Change-Id: I418a4d1f433bd4d440fc34e9a4932a9ea010b174 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* | | QML: Split qqmlmetatype{_p.h|.cpp} into multiple filesUlf Hermann2019-02-061-2/+2
|/ / | | | | | | | | | | | | | | Having all those classes in one big file promotes spaghetti code and makes the code unreadable. Change-Id: I3b6df93b9cfe1d97228771049b3054e78b868ea3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | QML: Don't accept assignment of Component to properties of other typesUlf Hermann2019-01-223-0/+12
| | | | | | | | | | | | | | | | This is dangerous and I don't see a reason why we should allow it. Fixes: QTBUG-72930 Change-Id: I01b9e624b4b80d52c1a847fa6ecd7a6d44614010 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | QML: Special case null as binding typeUlf Hermann2019-01-213-3/+3
|/ | | | | | | | | | | | This gives us the opportunity to map the JavaScript null to QVariant's concept of isNull(). [ChangeLog][QML] Assigning JavaScript null to incompatibly typed properties generates a compile error now, rather than a runtime error. Fixes: QTBUG-72098 Change-Id: I72fd1c30d84128c774230eaaea10455b2a0e064c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix issues with lookup of scoped enums on SingletonsMichael Brasser2018-10-313-1/+16
| | | | | Change-Id: Id6cd0b7c571b38db30bded030f6927c9b5fbdb96 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix erroneous enum conflict warningsSimon Hausmann2018-10-231-1/+1
| | | | | | | | | | | | | Permit enums from sub-classes to overwrite enums from super-classes, but keep warnings about clashes within a class, provided that the values differ. The last condition relates to the declaration of enums and a subsequent declaration of Q_FLAGS, which appear to have the same keys and values in the meta-object system. Task-number: QTBUG-71184 Change-Id: I2a00dc90e3714fc4c6fe8add5a6268b88bb9e745 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
* Fix lookup of methods in the scope objectSimon Hausmann2018-10-222-0/+27
| | | | | | | | | | | | | Commit 939014cb9cad2f3357f47b28a4580397c17b913c improved performance of property lookups beyond the scope object, with the unfortunate side-effect that the previously polymorphic lookup of methods broke. Fix this by moving the handling to the caller side and falling back to the string lookup for functions. Fixes: QTBUG-71204 Change-Id: I2d9924034a9c14e7d161fa49d51b1f876ab5bc0f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Provide option to skip registration of enum classes unscopedRainer Keller2018-08-214-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Enums classes are registered unscoped which leads to clashes in the following cases: 1. Two different enums contain the same values 2. The name of an enum class is the same as an enum value In the 2nd case you can not even access the scoped enum at all because it will be overwritten by the primitive type. Users can now add a class info to the meta type to disable the unscoped registration which solves all clashes. The default is kept as is. class MyClass : public QObject { Q_OBJECT Q_CLASSINFO("RegisterEnumClassesUnscoped", "false") public: ... }; [ChangeLog][QtQml] Added option to disable unscoped registration of enum classes. Change-Id: Ifa4197a14a252575e8a25ae56fb6ee479addf80b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for importing ES modules in .qml filesSimon Hausmann2018-08-179-0/+68
| | | | | | | | | | | | | | | | | This is a straight-forward hook into the module implementation in QV4::ExecutionEngine. Modules are pre-compiled in the QML type loader thread. That thread keeps track of all pending loading scripts through the type loader's m_scriptCache. Once a module is compiled, it's thread-safely registered with the execution engine. Script instantiation and evaluation is done solely in the QQmlEngine's thread. ES Modules are identified in imports as well as qmldir files by the .mjs extension. Change-Id: Ie9c59785118afcb49f43a1e176a9f7db00f09428 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Encapsulate access to CompiledData::Object and CompiledData::ImportSimon Hausmann2018-07-311-1/+1
| | | | | | | | This will make it easier to move the data out of CompiledData::Unit and into a separate data structure. Change-Id: I32e6233a66f2279b44cc06ef7c3505db4a565f98 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up constant storage for CompiledData::BindingSimon Hausmann2018-07-311-5/+6
| | | | | | | | | | Store doubles in bindings in the constant table of the compilation unit instead of each binding. This removes one of the two 8 byte members of the value union and also allows for sharing of constants throughout a .qml file. Change-Id: I1d7daafdb7f24e34c14cd160d2dcb2c5aaac1c50 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Encapsulate the unit data in CompilationUnitSimon Hausmann2018-07-312-3/+3
| | | | | | | | This allows updating the constants table when the unit data is set / changes and removes the tie to the engine. Change-Id: Ice553650390589e30e18421c4e55422a55d0df89 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up QQmlCustomParser APISimon Hausmann2018-07-302-13/+13
| | | | | | | | Consistently provide a smart pointer to the compilation unit in the two virtual functions. Change-Id: I2f43d4d17102082577f2502424d288d40eb7479d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Improve error messageRainer Keller2018-06-251-1/+1
| | | | | | | | | Show information about used types to help the user determine what went wrong. Change-Id: Ia71f21ee2bd53ba751bf0a3f7718f949d0e8330d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Provide API to access singletons associated with a QQmlEngineRichard Weickelt2018-06-211-0/+22
| | | | | | | | | | | | | | | | | | | This patch adds allows C++ code to retrieve the instance of a registered singleton type. Until now this required a deturn via QML expression. Two methods are added to QQmlEngine: A generic one that encapsulates all singleton objects in a QJSValue and a template function for QObject-derived singleton types. An additional convenience function is added to query the QML type id. This function may also be used for other purposes in the future. [ChangeLog][QtQml][QQmlEngine] Added API to access singletons associated with a QQmlEngine. Task-number: QTBUG-39970 Change-Id: I67c132ede35f80b9aaf1c5e5456715cf4f1b0848 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Ensure we read context properties before the global objectLars Knoll2018-06-171-1/+1
| | | | | | | | | | | | | | | Also global variables declared in a .pragma library script should not be saved in the global object, as the script has it's on context where those variables live. [ChangeLog][QtQml] Properties of the JS global object will now be looked up after local properties in the QML object. This can lead to runtime incompatibilities if your qml file is named the same as a property of the global object (e.g. Date.qml). Task-number: QTBUG-51581 Change-Id: I108aea4c76d088ca8c2124700f91e8eac3fc19f3 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Ensure identical behavior for singleton types defined in C++ and QMLRichard Weickelt2018-06-083-2/+42
| | | | | | | | | | | | | | | | Singleton types defined in C++ have no QML context. Therefore, both qmlContext(obj) and qmlEngine(obj) return zero. Although documented, this behavior is surprising and inconsistent with singleton types defined in QML. The current behavior was decided upon in QTBUG-23116. This patch puts C++ singleton types into a sub-context of the root context by default, just like it is the case for QML-defined singleton types. This doesn't cause any harm, but avoids surprises. It also fixes a bug in QmlTypeWrapper that returned an invalid QVariant for QJSValue singletons. Task-number: QTBUG-38583 Change-Id: Id1d48ecdc49f0e22714857a1b49b457885889e5e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Show property name in error messageRainer Keller2018-06-041-1/+1
| | | | | Change-Id: Ic78a38200959e39375753624af13c6edebe4e1f1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Improve error location reporting for custom propertiesSimon Hausmann2018-05-021-1/+1
| | | | | | | | | | | | | | | | When declaring a property with custom types, such as Item { property MyType foo; } and the engine failed to figure out what "MyType" was, it would report an error about that and print the location of Item {}. That was the case only for historical reasons and nowadays we can easily report the location where the property exactly is declared. Change-Id: Idaf2e796790cde1bc0794e6210b751c431211860 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Clean up manual reference of QQmlTypeData and QQmlPropertyCacheSimon Hausmann2018-04-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | We have a few places in the type loader where we do adventurous manual reference counting, where getType() returns a raw pointer that has been addref()'ed and then sometimes somehow we call release() later. Commit 0b394e30bba4f6bb7e6f7dbe5585a2e15aa0f21d is an example of where this can easily go wrong. As a consequence and also in preparation for future work on the type loader, this patch starts replacing the manual reference counting there. Changing the return type from QQmlTypeData *getType() to a QQmlRefPointer<> itself is not sufficient though, as the implicit operator T*() will still allow the caller to store the result as a raw pointer. Therefore this patch removes the "unsafe" implicit extraction operator. As a result of that change, other types that are sometimes stored in QQmlRefPointer are also affected and their usage needs to be adapted to QQmlRefPointer usage or manual raw pointer extraction with .data(). Change-Id: I18fd40634047f13196a237f4e6766cbef3bfbea2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Bring JS grammar in line with ES7 specLars Knoll2018-04-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This basically updates all grammar rules in the qqmljs.g file to be in line with the ES7 specification. Some special handling for the lookahead rules appearing in the spec was needed and is implemented through empty lookahead rules in the grammar, that might push an additional token into the token stream. Renamed some classes in the AST to be in line with the names used in ES7, and removed some other ones (SourceElements) that are no longer used. The ES7 grammar rules contain lots of variations of the base rules (with In/Return/Yield/Default suffixes). With the exception of the In and Default rules, these are implemented through state tracking in the parser and lexer. Change-Id: I4017d97cd050ed816c1dad11833e882cba30801a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Warn about non spec compliant extension being usedLars Knoll2018-04-111-2/+2
| | | | | | | | | | | | eval("function(){}") would return a function object in our engine. This is not compliant with the ES spec, so warn about it, as it'll start throwing a syntax error in 5.12. Also fix the two places where we were using that syntax in our auto tests. Change-Id: I573c2ad0ec4955570b857c69edef2f75998d55a9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix QML data structure version checking for ahead-of-time generated filesSimon Hausmann2018-03-201-2/+1
| | | | | | | | | | | | | | | | | | We must also do version checking for QML and JS files that were compiled ahead of time and are embedded in resources. If the lookup for the original source code fails, then we must generate an appropriate error message. As an upside we get better error reporting when trying to load an empty file and Qt.include() now reports the error message in the statusText field. The error reporting for imported scripts was not changed as importing an empty script is (oddly) allowed. Task-number: QTBUG-66986 Change-Id: Ie0ef81af371a51ecf8c66ae7954d43f5cc6c12de Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Fix assigning objects to QJSValue propertiesSimon Hausmann2018-03-202-0/+6
| | | | | | | | | | | | | | We support simple object bindings such as someProperty: Rectangle { ... } when the type of "someProperty" is QVariant, but we produce an error when it's QJSValue. There is no good reason for that, and the fix for QTBUG-67118 requires this. Change-Id: Ia5dc88749bcba0b5c781a6ab2b4a9fb92299e0ac Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>