aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qdeclarativecompiler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rewrite multiline strings properlyAlan Alpert2012-02-091-4/+3
| | | | | | | | | | | | | | | | Because the bindings rewriter works on code strings, it would leave multiline strings across multiple lines (which is illegal in ECMAScript. It now manually breaks them up when it sees them, by replacing a \n character with a literal \n. Since RewriteSignalHandler now likes to have the AST passed in too, the related method in QDeclarativeCompiler (and its customers) have been altered to use the QDeclarativeScript::Value instead of just a string. Task-number: QTBUG-23387 Change-Id: Id060de37e70590c9da2a902038ed02d948fdd70f Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: If39bd256b0fa85eba17ea30f8ab87ea27d758908 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Improve QRegExp property literal assignment error messageChris Adams2012-01-271-0/+3
| | | | | | | | | | | Previously, the error message given when a string literal was assigned to a regular expression property was not very helpful. This commit adds a better error message. Task-number: QTBUG-23068 Change-Id: Ia57b6434b9cdf009429e7b55edab4ab5c2b91c2a Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Use QMetaType::QVariant as the type for QVariantKent Hansen2012-01-251-8/+6
| | | | | | | | | | | Change http://codereview.qt-project.org/#change,12408 in qtbase updates moc and friends to use QMetaType::QVariant instead of the magic -1 / 0xffffffff / QVariant::LastType. This change adapts qtdeclarative accordingly. Change-Id: Ifb120485a4ee1501df6ad42d8ecd590824c85e9f Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com> Reviewed-by: Chris Adams <christopher.adams@nokia.com>
* Allow JS API in modulesMatthew Vogt2012-01-241-9/+18
| | | | | | | | | Allow modules to export verisoned javascript code into specified namespaces. Task-number: QTBUG-20857 Change-Id: Ic968c697ba36cbc4535870ed5eed2fe7f01af11d Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Update obsolete contact address.Jason McDonald2012-01-231-1/+1
| | | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I6a730abc0c396fb545a48b2d6938abedac2e3f1c Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
* Allow QML URLs to contain pre-encoded octetsMatthew Vogt2012-01-181-2/+10
| | | | | | | | | Use QUrl Tolerant parsing mode to permit user-supplied URLs to contain pre-encoded octets which are not mangled by string conversion. Task-number: QTBUG-22756 Change-Id: I4b160b04340b95221d1eb3336bda8c0b38d2e232 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
* QDeclarativeExpression: storing column number in expression locationChristiaan Janssen2012-01-161-0/+2
| | | | | Change-Id: I2d69738158abfc76f80b1cfc0e0ccb145fda2245 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Improve QML error messagesAaron Kennedy2012-01-061-10/+21
| | | | | | | | Point at the actual property and method name when raising errors about them. Change-Id: Id36df4850b91ae0d225fcda4d101f4b2a073a72e Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I0a8d99909cac867dce72da70b1bbcb649989a51b Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Reserve enough space in the QDeclarativePropertyCache hashAaron Kennedy2011-12-221-5/+6
| | | | | | | | It was too easy for callers of copy() to pass the wrong reserve size, so a new copyAndAppend() method has been added to reduce error. Change-Id: If2f13e2e0733e5d87c527934dc5a6c8d0c8df572 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Detect and optimize qsTr() and qsTrId() bindingsAaron Kennedy2011-12-211-27/+146
| | | | | | | | | As these two are frequently used with constants, we can detect them in the compiler, and run the appropriate C++ functions directly in the VME. This saves pointlessly creating and running bindings. Change-Id: I148a150400c13fda7955949453405202f18b1a6b Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Add a tracing API for the QML engineAaron Kennedy2011-12-141-0/+3
| | | | | Change-Id: Ic03583444d586f275897d765be8e1b5e69fdd5d4 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Fix crash when QtQuick 2.0 wasn't importedAaron Kennedy2011-12-051-10/+18
| | | | | | | | | The QML compiler still tried to resolve the implicit "Component" element within the QtQuick 2.0 namespace. Task-number: QTBUG-23017 Change-Id: I62ae962f58787910a76f76c872daa08874b5df56 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Take multi-line expressions into account when rewriting expressionsKai Koehne2011-12-011-0/+1
| | | | | | | | Take into account the newlines expressions might have when combining multiple expressions into one. Change-Id: Ib7170f624b6b6dee522e2d376a513ac08a8baa46 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Add support for assigning literal value to sequence propertyChris Adams2011-12-011-0/+89
| | | | | | | | | | | | | | | | | It is a language semantic that we allow clients to assign a single value to a sequence/list property (assuming that the types match). Now that we support sequence types, this commit adds support for this semantic by determining whether the built-in type of the literal corresponds to the associated sequence (eg, int for QList<int>, qreal for QList<qreal>, bool for QList<bool>, QString for QStringList etc). Similarly, some value types can be constructed from literal string values (via string converters) and these need to be handled also. Task-number: QTBUG-18062 Task-number: QTBUG-21770 Change-Id: Iacd91b2af122cd8f20b7df2fa6056a7d7c52bf53 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Rewrite Connections signal handlers at compile time.Michael Brasser2011-11-281-0/+6
| | | | | | Task-number: QTBUG-22726 Change-Id: I039d54661bbf7d44912c894bf0cc1d70023a9187 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Use the AST for binding rewriting when possible.Michael Brasser2011-11-231-3/+3
| | | | | Change-Id: I1ac8bd39ea7e02f7c236c030ca233e1060746431 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Rewrite signal handlers at compile time.Michael Brasser2011-11-201-3/+4
| | | | | | | Task-number: QTBUG-22726 Change-Id: If2c3c00c646b2ed6b6899573a0b487c8deeaad3f Reviewed-by: Kai Koehne <kai.koehne@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Allow aliases to QVariant propertiesAaron Kennedy2011-11-161-1/+2
| | | | | | Task-number: QTBUG-22464 Change-Id: I449d4fc709d34a69116258660d721596cd9b778b Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
* Declarative: Fix gcc 4.6 warnings about assigned/unused variables.Friedemann Kleint2011-11-011-3/+3
| | | | | | Change-Id: Iac4bb4a6b1aa4071a239bb25f25f01b71e36868b Reviewed-by: Alexis Menard <alexis.menard@openbossa.org> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Readonly QML property supportAaron Kennedy2011-10-261-21/+32
| | | | | | Task-number: QTBUG-15257 Change-Id: I539b6e6a9e0e0172b68e8002aaa3f7c7e6648769 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Rename QDeclarativePropertyCache::Data to QDeclarativePropertyDataAaron Kennedy2011-10-261-20/+20
| | | | | | | This class is now too large to be nicely nested. Change-Id: I32cfa5caa524b8bf447d1f8c53ef2763f60bdac1 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Update calls for keyToValue and keysToValueLiang Qi2011-10-241-11/+15
| | | | | | | | | | They are from QMetaEnum and changed recently Task-number: QTBUG-21672 Change-Id: I46698ec7eb4a1b23068146593ee93f71fc53a815 Reviewed-by: Kent Hansen <kent.hansen@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com> Reviewed-by: Liang Qi <liang.qi@nokia.com>
* Clean up declarative includesKent Hansen2011-10-171-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (This commit is in preparation of moving several files to a separate library (QtQuick2).) Don't add all subfolders to the includepath (from the .pri files). There's no good reason to do that. For headers (both public and private) that are in the same folder as the file that includes them, prefer to use #include "foo.h" #include "bar_p.h" For public headers that are outside the current folder but have "unambiguous" names (e.g. qdeclarative prefix), use #include <foo.h> For private headers that are outside the current folder, use #include <private/baz_p.h> Also change #include <QtDeclarative/private/foo_p.h> to #include <private/foo_p.h> The header filenames already have a qdeclarative or qsg prefix; there's no need to prefix by module name to disambiguate. Finally, #include "private/foo_p.h" should be avoided. private/ is used for auto-generated (forwarding) headers, which never reside in the current (source) directory. Use angle brackets instead. Change-Id: I04f8477fdba043546064ee276475c09dc373f8f2 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Merge PropertyCache::Data and ValueTypeDataAaron Kennedy2011-10-171-18/+10
| | | | | Change-Id: I22cbb159d009151dd77ecbcdad16f27ecb9d6dba Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Remove QMetaObjectBuilder from declarative.Friedemann Kleint2011-10-141-1/+1
| | | | | | | | Link on Windows. Change-Id: Idca11c1a21ad5aebf79d6487692d912b4dea249f Reviewed-on: http://codereview.qt-project.org/6553 Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
* Rename QDeclarativeV4 -> QV4Aaron Kennedy2011-10-121-3/+3
| | | | | | | Change-Id: Ic35e0ad1663cafe4aa535594dc3999a2d317ce0e Reviewed-on: http://codereview.qt-project.org/6301 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com> Sanity-Review: Aaron Kennedy <aaron.kennedy@nokia.com>
* Add JavaScript "var" property type to QMLChris Adams2011-10-061-20/+99
| | | | | | | | | | | This commit adds a new syntax which allows "var" type properties which can have JavaScript objects (as well as other basic types) assigned to them. Such JavaScript objects cannot be bound to. Task-number: QMLNG-18 Change-Id: If7f5045f4669e0d5c1b8d0891ed765128d0bc1c6 Reviewed-on: http://codereview.qt-project.org/1466 Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Set isRoot correctly for value typesAaron Kennedy2011-10-051-5/+16
| | | | | | | Change-Id: I1ddbe5a76fd804df51a3feaf1c0a9004a67abf9f Reviewed-on: http://codereview.qt-project.org/6023 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Remove more QByteArray<->QString conversionsKent Hansen2011-09-291-5/+5
| | | | | | | | | | Prefer to store types as QStrings. It's only when we manipulate raw (compiled, meta-)data that utf conversion is needed. Change-Id: Ie138a69c9a409804e1b90b21c1d60dedea35bddb Reviewed-on: http://codereview.qt-project.org/5781 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Asynchronous component instantiationAaron Kennedy2011-09-291-51/+111
| | | | | | | | | | | | | This introduces two main: * the QML compiler executes in a separate thread * item instantiation can be interrupted and resumed to allow it to be split across multiple frames. Task-number: QTBUG-21151 Change-Id: I9631c62bb77da3a2e0c37f0da3719533fdce4fef Reviewed-on: http://codereview.qt-project.org/5676 Reviewed-by: Martin Jones <martin.jones@nokia.com>
* Make the QML/VME interpreter threadedKent Hansen2011-09-221-291/+272
| | | | | | | | | | | | | | | | | | | | | | | | | | | This gets rid of the two-level dispatch in the interpreter loop, which gives a nice performance boost when many VME instructions must be interpreted (e.g., 40% faster for 100 StoreInteger instructions). The threading is implemented in a similar way to the V4 interpreter. The way the compiler generates instructions has been refactored, chiefly to get rid of the QDeclarativeInstruction::setType() calls (when using threading, we don't store the instruction type at all, only the address). As a nice bonus, the way instructions are defined now (creating the specific instruction's data type, rather than a generic (union) type) is more compact and less error-prone. Change-Id: If5cbd36b2526fd61b74854712711b06cd7e1ed7d Reviewed-on: http://codereview.qt-project.org/5246 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
* Get rid of QDeclarativeUtilsKent Hansen2011-09-191-10/+9
| | | | | | | | | | | All the QChar methods needed by QtDeclarative have now been optimized to achieve at least as good performance as the QDeclarativeUtils versions. Change-Id: I5b8dd58f9b597f716b53563d07d39d894c5dd666 Reviewed-on: http://codereview.qt-project.org/5059 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix export symbols for QtDeclarative and QtQuick1.Friedemann Kleint2011-08-311-2/+2
| | | | | | | | | | | Fix build on Windows and compiler warnings. Requires 090ee21eac7257644422e35395194e5fd7fb8efa in qtbase. Change-Id: Ief8da504ccd3e2c2e78644cc9943d685c4302019 Reviewed-on: http://codereview.qt.nokia.com/3988 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Fix merge errors introduced while rebasing.Roberto Raggi2011-08-301-2/+8
| | | | | | | Change-Id: I14973b94f404f9e4fe06b192ef177f01e0f5ef01 Reviewed-on: http://codereview.qt.nokia.com/3801 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Move all QML file parsing into the QDeclarativeScript namespaceAaron Kennedy2011-08-301-100/+97
| | | | | | Change-Id: I5969686a796cbfb2eeb3729014df7f01e51b0620 Reviewed-on: http://codereview.qt.nokia.com/3797 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Fix lookup of non scriptable default properties.Roberto Raggi2011-08-301-7/+8
| | | | | | | Change-Id: I027169a54dc0041212d38aefc99164930c31d2b2 Reviewed-on: http://codereview.qt.nokia.com/3793 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Fix compilation.Roberto Raggi2011-08-301-3/+3
| | | | | | | Change-Id: I75433c3c716b6df33b75d32805fcca822f49a202 Reviewed-on: http://codereview.qt.nokia.com/3791 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Fix type of valuetype alias properties.Roberto Raggi2011-08-301-0/+5
| | | | | | | | | | Update the type and the typename after changing the value of aliasProperty. Change-Id: Id0b9d9a66f14524fec6bf23c375ae9af448cbbf3 Reviewed-on: http://codereview.qt.nokia.com/3790 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Set the name of the default propertyRoberto Raggi2011-08-301-1/+8
| | | | | | Change-Id: I4f69b9e4e33a789215941f8021b8937c8aa2e7c1 Reviewed-on: http://codereview.qt.nokia.com/3783 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Fix initialization of QDeclarativeVMEMetaData::PropertyData for variant ↵Roberto Raggi2011-08-301-1/+1
| | | | | | | | | | | | properties. The propertyType member for variant properties needs to be initialized to -1 (at least according to QDeclarativeVMEMetaObject::metaCall). Change-Id: I44f226f2bce3732f3a4220fe24617b5cb2292f97 Reviewed-on: http://codereview.qt.nokia.com/3778 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Reduce allocationsAaron Kennedy2011-08-301-2/+2
| | | | | | Change-Id: I230424147ad195239d725359fcd6dc5568f102a7 Reviewed-on: http://codereview.qt.nokia.com/3772 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* less toUtf8()Martin Jones2011-08-301-1/+1
| | | | | | | Change-Id: I9c4b599511e755b8f93d8bb8a7cd3732ca380de0 Reviewed-on: http://codereview.qt.nokia.com/3771 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Remove some QString <-> utf8 conversions.Martin Jones2011-08-301-8/+8
| | | | | | | Change-Id: I4478ec805f5b1e05025baafaf7035b8fb57f9854 Reviewed-on: http://codereview.qt.nokia.com/3770 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Optimize default property resolution in compilerAaron Kennedy2011-08-301-53/+80
| | | | | | Change-Id: I90b677a190c0c59ba681a7643a9b13cfb938d5a1 Reviewed-on: http://codereview.qt.nokia.com/3769 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Use the cached property data when possibleAaron Kennedy2011-08-301-6/+4
| | | | | | | Change-Id: I6690208b9a4d99e485874c5253d69cb82938c8a6 Reviewed-on: http://codereview.qt.nokia.com/3768 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com> Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
* Introduce QHashField for use in "contains" tests.Aaron Kennedy2011-08-301-6/+4
| | | | | | Change-Id: I35aadace15b71b44c1b9e30a76eadf79fe03afad Reviewed-on: http://codereview.qt.nokia.com/3767 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Use QFieldList to manage dynamic properties, signals and slotsAaron Kennedy2011-08-301-110/+113
| | | | | | Change-Id: I27282a035a631dde30ee97412d3968ab525b2502 Reviewed-on: http://codereview.qt.nokia.com/3766 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
* Use strings more conservativelyAaron Kennedy2011-08-301-32/+37
| | | | | | | | | Also adds the ability to efficiently estimate the length of, and write out to, UTF8 from QHashedStringRef. Change-Id: I8b6226ba41d855246ddf7d6268f8045c92ae219e Reviewed-on: http://codereview.qt.nokia.com/3764 Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>