aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser
Commit message (Collapse)AuthorAgeFilesLines
* Silence a GCC 8 warning in qqmljsparserVille Voutilainen2018-02-281-1/+1
| | | | | | | | qtdeclarative/src/qml/parser/qqmljsparser.cpp:82:129: error: ‘void* realloc(void*, size_t)’ moving an object of non-trivially copyable type ‘class QStringRef’; use ‘new’ and ‘delete’ instead [-Werror=class-memaccess] string_stack = reinterpret_cast<QStringRef*> (realloc(string_stack, stack_size * sizeof(QStringRef))); Change-Id: I670b8a860bf3dc9c20126306f7848f38acd75ca9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* init variables where they are declared when possible (clang-tidy)Shawn Rutledge2018-02-263-21/+13
| | | | | | | | clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-268-86/+86
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce Q_FALLTHROUGH()Friedemann Kleint2018-01-101-1/+1
| | | | | | | Silence g++ 7.X warnings. Change-Id: Iba80ab547111d883ff8b3e99173cc5f3a79ae81f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/dev' into wip/new-backendLars Knoll2017-08-2212-1380/+1634
|\ | | | | | | Change-Id: Iff06429f948ac6cdec77a9e5bb8c5375c56fe705
| * Restore yylval initializationSimon Hausmann2017-08-182-0/+2
| | | | | | | | | | | | | | | | | | Forward port commit b04b7d340f39dfdde560b1303ea6a8c8ace8056e to do the initialization in the original file, not in the generated one. Change-Id: I070d9668c75be20c014835514db49d1a6518d590 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Michael Brasser <michael.brasser@live.com>
| * Support explicit enum value declaration in QMLMichael Brasser2017-08-186-737/+825
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow declarations such as: enum MyEnum { Value1 = 1, Value2 } Not all features of C++ enums are supported. Specifically, we don't yet allow: * Negative numbers (Value1 = -1) * Assignment of other values (Value2 = Value1) Change-Id: I4776f8d86bd0c8688c7dd8b7d4ccb2f72fdfe721 Task-number: QTBUG-14861 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Initialize members in parserRobert Loehning2017-08-102-0/+2
| | | | | | | | | | Change-Id: Iea5f8ca269bb759c615c4768d63a7c09ec9975fa Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Add support for enum declarations in QMLMichael Brasser2017-07-1311-1380/+1542
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enums can be declared with the following syntax: enum MyEnum { Value1, Value2 } Grammar changes done by Simon Hausmann. [ChangeLog][QtQml] Enums can now be declared directly in QML. Task-number: QTBUG-14861 Change-Id: Ic6b6e032651d01ee2ecf9d5ce5734976cb3ad7ab Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove a couple of references to the IRLars Knoll2017-06-201-1/+2
|/ | | | | Change-Id: I716000a6932a6b3d3f6c9f0573747b9c4b8e0e6b Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-061-0/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/qml/jsruntime/qv4argumentsobject.cpp src/qml/jsruntime/qv4arraydata.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4errorobject.cpp src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4internalclass.cpp src/qml/jsruntime/qv4lookup.cpp src/qml/jsruntime/qv4managed.cpp src/qml/jsruntime/qv4managed_p.h src/qml/jsruntime/qv4object.cpp src/qml/jsruntime/qv4object_p.h src/qml/jsruntime/qv4qmlcontext.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4heap_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/memory/qv4mmdefs_p.h src/quick/scenegraph/util/qsgdistancefieldutil.cpp src/quick/scenegraph/util/qsgdistancefieldutil_p.h tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp Change-Id: I7ed925d4f5d308f872a58ddf51fdce0c8494ec9c
| * 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.9' into devSimon Hausmann2017-04-111-6/+10
|\| | | | | | | Change-Id: I95914046889022e0ef9bdc17338dc5895c5223fe
| * 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>
* | | parser: Add "let" keyword (& T_LET)Robin Burchell2017-02-036-1076/+1139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We also tie this up to the existing skeletal "const" support so that they are also checked for duplicate declarations. While we do that, change from using a boolean to an enum so we make the scope of a declaration a little more easily comprehensible. Change-Id: I6a6e08aed4e16a53690d6f6bafb55632807b6024 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Codegen: Disallow const declaration without an initializer expressionRobin Burchell2017-02-021-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This seems to match up with the spec behavior. 13.3.1.1 (Static Semantics: Early Errors) says: It is a Syntax Error if Initializer is not present and IsConstantDeclaration of the LexicalDeclaration containing this production is true. In addition, we also allow "const" to be used in JS mode too. We don't yet fully support the semantics, but as it's there, why not let it work. [ChangeLog][QtQml] "const" variable declarations are now available in JS as well as QML mode. [ChangeLog][QtQml] "const" variable declarations now require an initializer, bringing them closer to the required spec behavior. Task-number: QTBUG-58493 Change-Id: Ife5d5979b3e7a5d7340bf04f43605f847ee25ee2 Reviewed-by: Simon Hausmann <simon.hausmann@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>