aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser
Commit message (Collapse)AuthorAgeFilesLines
* QQmlComponent: Fix heap buffer overflow with bogus inputPeter Hartmann2017-05-031-0/+5
| | | | | Change-Id: I8a725018a5aeb39df370f856cd77d887faa511e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-04-111-6/+10
|\ | | | | | | Change-Id: Ib3d81ad33a6ba28d891da91271a64d5fcc4874e6
| * Prospective fix for static builds on Windows with QtQuickCompilerSimon Hausmann2017-03-281-6/+10
| | | | | | | | | | | | | | | | Don't define QML_PARSER_EXPORT to dllimport when doing static builds. Task-number: QTBUG-59767 Change-Id: I24acb2c51f54a0cde8d2e50a935ede876e5eb5b7 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-147-1152/+1191
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp src/plugins/qmltooling/qmldbg_inspector/globalinspector.cpp src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp src/qml/qml/qqmlimport.cpp src/quick/items/context2d/qquickcontext2dtexture_p.h tools/qmleasing/splineeditor.h Change-Id: I8f6630fcac243824350986c8e9f4bd6483bf20b5
| * Fix support for namespaced types in property/signal declarationsSimon Hausmann2016-11-306-1151/+1187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Declarations such as property Namespace.Item foo or property list<Namespace.Item> foo would get rejected by the grammar due to the lack of productions. This is now encapsulated in the UiPropertyType, which used to be merely an identifier but is now changed to produce a UiQualifiedId - the same type that's also used for MyNamespace.Item { ... } object declarations for example. Task-number: QTBUG-10822 Change-Id: Ic3ac1adbe17c83b24b67950c2f089e267b73b99b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-281-1/+4
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The renderers added in 5.8 had to be adapted to the changed profiling macros from 5.6. Conflicts: src/plugins/scenegraph/d3d12/qsgd3d12renderloop.cpp src/plugins/scenegraph/d3d12/qsgd3d12threadedrenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp src/quick/util/qquickprofiler_p.h tests/auto/qml/qjsengine/tst_qjsengine.cpp tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp Change-Id: Icb370b7c95aab12589ad73881ac6d178759a5c6b
| | * Merge remote-tracking branch 'origin/5.6' into 5.75.7Liang Qi2016-11-251-1/+4
| | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/qml/v8/qqmlbuiltinfunctions.cpp src/quick/util/qquickprofiler_p.h Change-Id: I11a89c2a166115d6697adfba09928805643e709e
| | | * QML: Check for failing realloc/malloc in the QmlJS memory poolErik Verbruggen2016-11-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should make (properly functioning) static code checkers stop complaining. Task-number: QTBUG-57025 Change-Id: Ic7e6f1b0b02f2e9324dbc891ab4620d53d9f9a18 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-12-145-1087/+1201
|\| | | | | | | | | | | | | | | Change-Id: I905dcd29377bf1b2e0ee086823b54277d18e78dd
| * | | Fix support for QML declared default list propertiesSimon Hausmann2016-11-235-1073/+1130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The grammar was not permitting to write default property list<Item> myChildren; and instead developers had to work around it with an alias property list<Item> myChildrenData; default property alias myChildren: myChildrenData which is not nice. Fortunately this is easy to fix in the grammar. Task-number: QTBUG-10822 Change-Id: I4e914ddb9588913da09e9fb6c6aa154cf8a9e18f Reviewed-by: Lars Knoll <lars.knoll@qt.io>
| * | | Fix up QML grammar fileSimon Hausmann2016-11-231-14/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 45bd04ba73bd3e71c070e5724535ba87f6771323 changed the embedded license headers to the $LGPL tag but accidentally removed the header that is embedded in the output. In addition there have been changes to the generated code that were not reflected in the .g file. With these changes the qlalr output matches the files that are checked in. Change-Id: I693e20cf5237098425ba79182089d213179e6dfa Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | | headers: Add missing override and remove redundant virtualAlexander Volkov2016-12-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Change-Id: Ifa816ebcd79372afca42dbd0dc0ecde006bb688a Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | | Qml: add missing 'override'Anton Kudryavtsev2016-10-061-277/+277
|/ / / | | | | | | | | | | | | | | | | | | ... and drop redundant 'virtual' Change-Id: I8c0d589557f590eb528e80414d9c002504ccb12a Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* / / Replace QString::trimmed() with QStringRef::trimmed()Anton Kudryavtsev2016-07-061-1/+1
|/ / | | | | | | | | | | | | | | ... where it's possible. Reduce allocations. Change-Id: I503507f8f29e2455113c48e50389a6fdf80e1d16 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Eradicate Q_FOREACH loops from headersMarc Mutz2016-05-111-1/+1
| | | | | | | | | | | | | | | | They may prevent use of QT_NO_FOREACH in other Qt modules. Change-Id: Iafc04a73579a90492f3ff303978b78b71eec4e55 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Replace qQNaN() and friends with qt_qnan().Erik Verbruggen2016-04-051-3/+3
| | | | | | | | | | | | | | | | These constexpr functions can be inlined, and the compiler can be a bit smarter with code generation. Change-Id: I4ea87c794dd8e375749e18d273d01bb848231113 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | V4: Allow the compiler to inline more small methods.Erik Verbruggen2016-03-201-2/+2
| | | | | | | | | | Change-Id: Ib2dc03a2535fcbdb10be2dab39593e8dc224fd93 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2016-01-221-1/+18
|\| | | | | | | Change-Id: I4af0bf8ec1569097d97f8ce0bb8bf1a0e4a989ec
| * Fix up commit 9d7b27f5bf44a46707e6d50ebf51ecf73f91dd1bSimon Hausmann2016-01-161-1/+18
| | | | | | | | | | | | | | | | | | That commit changed qqmljsgrammar.cpp, which turns out to be a generated file. Therefore it's important to also make the modification to the original grammar file, to ensure that future re-generations of the file contain the new code. Change-Id: Id913b29e4a70bfa0c2786073c46dcc206c28b6ee Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Updated license headersJani Heikkinen2016-01-1917-284/+341
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: Ic36f1a0a1436fe6ac6eeca8c2375a79857e9cb12 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devLiang Qi2016-01-102-5/+5
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.h tests/auto/quick/qquicklistview/tst_qquicklistview.cpp tests/auto/quick/qquicktextedit/qquicktextedit.pro tests/auto/quick/qquicktextinput/qquicktextinput.pro Change-Id: I95d2c20a8619e5b8fa361c941a16dd8dce3e04e7
| * Remove prohibited uses of underscore + capital letterThiago Macieira2016-01-082-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | All identifiers starting with an underscore and a capital letter are reserved to the compiler and must never be used by the user code. Try to find a better name or, in the worst case, move the underscore to the last position in these identifiers. See commit cf63c63d558227fdbef09699c261560e7474f5ea in qtbase for a case of such an identifier causing a build breakage when the compiler began treating it specially (it was _Nullable). Change-Id: I1d0f78915b5942aab07cffff140f9f39c29f0fdf Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* | Remove dead codeFrank Meerkoetter2015-12-191-1/+1
| | | | | | | | | | | | | | Fixes coverity CID10615. Change-Id: I46861e4ddcc0347e9ba53da5b94acb813f67ab89 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* | Replace all occurrences of qSNaN() with qQNaN()Ulf Hermann2015-12-071-2/+2
|/ | | | | | | | | | | We generally don't want to produce signalling NaNs as those cannot be used in any further arithmetic operations. In particular -(qSNaN()) claims it's not a double. Task-number: QTBUG-49753 Change-Id: I23cec4fec2ddf08c02a7d53db7f3b9ba46b6c288 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add missing "We mean it" comments to private headers.Friedemann Kleint2015-10-061-0/+11
| | | | | | Task-number: QTBUG-48594 Change-Id: Ifc207938de7f0c8995fc712df92665f222612647 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
* Remove unused codeFrank Meerkoetter2015-08-021-22/+0
| | | | | | | There are no users of this visitor interface left. Change-Id: I8d912c3441bd8a67293eee443451dcea392308ee Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Fix invocations of static methods of QGuiApplication/QCoreApplication.Friedemann Kleint2015-03-052-11/+11
| | | | | Change-Id: I7bcc209b0c6e77cf6d974af85a19487345a48975 Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-1217-133/+133
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9 Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
* Clean up JS .import/.pragma directive scanningSimon Hausmann2015-01-085-26/+176
| | | | | | | | | | | There's a scanner in QQmlJS::Lexer::scanDirectives that can parse those, so let's get rid of extra parser that operates on a string. Instead this way we can do the scanning all in one shot, avoid detaching a copy of the source code string and (most importantly) bring the parser closer to the copy in Qt Creator, which uses the directives approach to extract imports and pragma. Change-Id: Iff6eb8d91a45d8a70f383f953115692be48259de Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
* QQmlJS::Lexer::scanNumber: Use a QVarLengthArray to avoid heap allocations.Robin Burchell2014-12-191-2/+1
| | | | | | | | This shaved the time of this function in half on an (admittedly very morbid) testcase of mine, from 161ms to 72ms total. Change-Id: I88ad8d4ad4791dc4e7eadb9af9265ff02fe5376f Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* Fix syntax error when trying to declare read-only object propertiesSimon Hausmann2014-10-245-1030/+1063
| | | | | | | | | | | | | | | | | | | | The grammar did not allow for the declaration of readonly property QtObject foo: QtObject { ... } and it required a workaround through an alias: readonly property alias foo: _foo property QtObject _foo: QtObject { ... } This was merely a glitch in the grammar, I see no reason not to support this. The semantics are like a const pointer in C++, the property itself is read-only but the object pointed to has per-property defined read/write semantics. Task-number: QTBUG-41971 Change-Id: I99e2e7ed58731e387a38e46ec39922d280a21ceb Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix license headers in Qml grammar specificationSimon Hausmann2014-10-241-48/+42
| | | | | | | | | | The grammar file itself wasn't updated accordignly and the license headers that are embedded in the grammar that will be copied into the generated files were also oudated. Re-generating the parser would produce files with the wrong license headers. Change-Id: I1db83df8a9c4bddfb58901f41a4d40f6b1396507 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-2516-304/+176
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I84a565e2e0caa3b76bf291a7d188a57a4b00e1b0 Reviewed-by: Jani Heikkinen <jani.heikkinen@digia.com>
* Fix packaging buildsSimon Hausmann2014-04-281-2/+2
| | | | | | | | In order to access the js parser in release builds, we need to export these symbols (althoug they remain private API). Change-Id: Id534bfc8027f9a6feab53b09e7397d920e59e3f8 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix marking of prototype objects in internal class poolSimon Hausmann2014-04-281-0/+24
| | | | | | | | | | As per reported bug, we have to protect ourselves against potential loops and can mark the internal classes much simpler by just walking through the memory pool they were allocated in. Task-number: QTBUG-38299 Change-Id: I3ae96e8082e76d06f4321c5aa6d2e9645d2830a0 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [new compiler] Fix error reporting for group propertiesSimon Hausmann2014-03-021-1/+1
| | | | | | | | | | Report errors when setting group properties multiple times, or when assigning values to them. Some of this can be done right after parsing, some of it requires knowledge about the type of group property (QObject or value type) Change-Id: I1aa33e64a5f64dfa4f625469f5b6a84cd8dfb18d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Clean up object literal handling with integral indicesSimon Hausmann2014-02-241-6/+16
| | | | | | | | | | | | | | | | | | | | | * Object literals with array indices are now created with one run-time call, instead of an initial one for non-integral keys followed by sub-sequent define_builtin_property calls. * Cleaned up propert name retrieval. Instead of using a visitor, it's easier to define a virtual method on the PropertyName type. The visitor doesn't buy us much as it's not possible to recurse within property names, and this way we can use it also from the function scanner to correctly determine the number of arguments needed for object literal initalizations. * Similarly the duplicated/common name member for all property assignments has been moved into PropertyName, for convenient access without AST casts. * Removed now unused builtin_define_property/settergetter functions from IR, run-time and moth. Change-Id: I90d54c81ea5f3f500f4f4a9c14f7caf5135e7f9f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* fix whitespaceOswald Buddenhagen2014-01-221-1/+1
| | | | | | | remove trailing spaces and expand tabs Change-Id: Ieacb9d096b612c45d1a64700044c114d1f7522bc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
* [new compiler] Add support for implicitly defined componentsSimon Hausmann2014-01-101-0/+2
| | | | | | | | | | | | | | | Use-cases like itemDelegate: Item { ... } implicitly define a component without the item-surrounding Component {}, base on the fact that the property itself is of type QQmlComponent (or derived). This means we have to synthesize a Component {} object and insert it into the data structure. Change-Id: I8992451a5a6732c7fd898eaf83c276dc6a8b7d19 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Revert commit d818575966e2e2000fe2b7ee390c620f595d9825Simon Hausmann2013-10-212-8/+0
| | | | | | | | | | | | This reverts the commit that deprecated the with statement and added a note to the docs that binding expressions will be compiled in strict mode in Qt 5.2. It turns out that we had to keep the with statement and enabling strict mode breaks just too much unfortunately. Change-Id: Id38c27f684fbfcb6b6b848be8f691658089d1adb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Compile binding expressions in the QQmlCompilerSimon Hausmann2013-10-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is done by re-using the JS code generator from the new compiler. A few bugs were fixed on the way: * The index into the compiledData->runtimeFunctions array is not the same as the function index when they are collected (from the AST), as for example binding expressions may create extra V4IR::Function objects that break the 1:1 mapping. Therefore the JS code gen will return a mapping from incoming function index to V4IR::Module::Function (and thus runtimeFunction) * Binding expressions in the old backend get usually unpacked from their ExpressionStatement node. The reference to that node is lost, and instead of trying to preserve it, we simply synthesize it again. This won't be necessary anymore with the new compiler in the future. * Commit 1c29d63d6045cf9d58cbc0f850de8fa50bf75d09 ensured to always look up locals by name, and so we have to do the same when initializing the closures of nested functions inside binding expressions (in qv4codegen.cpp) * Had to change the Qml debugger service auto-test, which does toString() on a function that is now compiled. Even if we implemented FunctionPrototype::toString() to do what v8 does by extracting the string from the file, it wouldn't help in this test, because it feeds the input from a string instead of a file. * In tst_parserstress we now end up compiling all JS code, which previously was only parsed. This triggers some bugs in the SSA handling. Those tests are skipped and tracked in QTBUG-34047 Change-Id: I44df51085510da0fd3d99eb5f1c7d4d17bcffdcf Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add Singleton support for QMLAntti Piira2013-09-2110-1120/+1373
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces Singleton support for QML (Composite Singleton). For now, the Singleton support is only availabe for QML types in modules or (remote and local) directories with qmldir file. However, in the future this support may be expanded to arbitrary QML file imports without by leaving out the qmldir requirement. You define a QML type as a Singleton with the following two steps: 1. By adding a pragma Singleton to a type's QML file: pragma Singleton The pragma and import statements can be mixed and their order does not matter. Singleton is the only supported pragma for now. Others will generate errors. 2. By specifying a qmldir file for the directory of your imported type and prepending the type with "singleton" keyword as follows: singleton TestTypeSingleton TestTypeSingleton.qml Alternatively you may specify a qmldir file for a module and specify your type as a singleton as follows: singleton TestTypeSingleton 1.0 TestTypeSingleton.qml Composite Singletons may be included in a module and may be used with a local namespace qualifier when imported with: "import xxx as NameSpace" A singleton instance is created at first use and stored into the QmlEngine (one instance per engine) and eventually released by the engine's destructor. CompositeSingletonType has a dual nature and will return true to both isComposite() and isSingleton() calls. In most cases its enough to check for just isComposite() or isSingleton(). However, there is a isCompositeSingleton() available as well. I used "qlalr --no-debug --no-lines --qt qqmljs.g" to generate the qqmljsparser and qqmljsgrammar files from qqmljs.g. Unit tests are included. Change-Id: I91b303612c5e132143b325b9a8f982e9355bc90e Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com>
* Fix invalid condition in comparisson.Erik Verbruggen2013-08-093-2/+3
| | | | | | | | | Thanks to clang (top-of-trunk) pointing out that the unary not operator only applies to the left-hand side of the equality expression. Change-Id: I093b447d55995a4122aeac042a506eb56f8b2442 Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Fix another bug with automatic semicolon insertionSimon Hausmann2013-08-081-1/+2
| | | | | | | Avoid empty statements after else. Change-Id: Ia7782a3371bc79c7e93857aa252309d2824a5a9e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Move the parser folder from src/qml/qml to src/qmlLars Knoll2013-08-0818-0/+13711
Change-Id: I5e5684f5b98b00f791ade99c4cb6bc2ed880ad6a Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>