diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-02-01 01:41:07 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-02-01 01:41:07 (GMT) |
commit | 7e85c6dc7ba0aaa6dfcad40dc0e9df0e2adb3741 (patch) | |
tree | 07e839b8dd88c381471b96917ef5aafa484233b1 /src/declarative/qml | |
parent | 6e8feab83fa9303b1345f4a27478ba3ee0316e86 (diff) | |
parent | 5cf8677758e6fbfa5bf360c73519c14630db808c (diff) | |
download | Qt-7e85c6dc7ba0aaa6dfcad40dc0e9df0e2adb3741.zip Qt-7e85c6dc7ba0aaa6dfcad40dc0e9df0e2adb3741.tar.gz Qt-7e85c6dc7ba0aaa6dfcad40dc0e9df0e2adb3741.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts:
src/declarative/util/qmlpixmapcache.cpp
Diffstat (limited to 'src/declarative/qml')
51 files changed, 3564 insertions, 3061 deletions
diff --git a/src/declarative/qml/parser/qmljs.g b/src/declarative/qml/parser/qmljs.g index 70cf06a..90949d5 100644 --- a/src/declarative/qml/parser/qmljs.g +++ b/src/declarative/qml/parser/qmljs.g @@ -1,45 +1,24 @@ ---------------------------------------------------------------------------- -- --- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). --- Contact: Qt Software Information (qt-info@nokia.com) +-- Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +-- All rights reserved. +-- Contact: Nokia Corporation (qt-info@nokia.com) -- -- This file is part of the QtDeclarative module of the Qt Toolkit. -- --- $QT_BEGIN_LICENSE:LGPL$ --- No Commercial Usage --- This file contains pre-release code and may not be distributed. --- You may use this file in accordance with the terms and conditions --- contained in the either Technology Preview License Agreement or the --- Beta Release License Agreement. --- +-- $QT_BEGIN_LICENSE:LGPL-ONLY$ -- GNU Lesser General Public License Usage --- Alternatively, this file may be used under the terms of the GNU Lesser +-- This file may be used under the terms of the GNU Lesser -- General Public License version 2.1 as published by the Free Software -- Foundation and appearing in the file LICENSE.LGPL included in the -- packaging of this file. Please review the following information to -- ensure the GNU Lesser General Public License version 2.1 requirements -- will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -- --- In addition, as a special exception, Nokia gives you certain --- additional rights. These rights are described in the Nokia Qt LGPL --- Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this --- package. --- --- GNU General Public License Usage --- Alternatively, this file may be used under the terms of the GNU --- General Public License version 3.0 as published by the Free Software --- Foundation and appearing in the file LICENSE.GPL included in the --- packaging of this file. Please review the following information to --- ensure the GNU General Public License version 3.0 requirements will be --- met: http://www.gnu.org/copyleft/gpl.html. --- --- If you are unsure which license is appropriate for your use, please --- contact the sales department at qt-sales@nokia.com. +-- If you have questions regarding the use of this file, please contact +-- Nokia at qt-info@nokia.com. -- $QT_END_LICENSE$ -- --- This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE --- WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. --- ---------------------------------------------------------------------------- %parser QmlJSGrammar @@ -92,6 +71,8 @@ %token T_FEED_UI_OBJECT_MEMBER %token T_FEED_JS_STATEMENT %token T_FEED_JS_EXPRESSION +%token T_FEED_JS_SOURCE_ELEMENT +%token T_FEED_JS_PROGRAM %nonassoc SHIFT_THERE %nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY T_READONLY @@ -99,11 +80,11 @@ %start TopLevel -/. -/**************************************************************************** +/./**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -111,8 +92,8 @@ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -122,21 +103,20 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -153,11 +133,11 @@ ./ -/: -/**************************************************************************** +/:/**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtDeclarative module of the Qt Toolkit. ** @@ -165,8 +145,8 @@ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -176,25 +156,25 @@ ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ + // // W A R N I N G // ------------- @@ -229,7 +209,7 @@ namespace QmlJS { class Engine; class NameId; -class Parser: protected $table +class QML_PARSER_EXPORT Parser: protected $table { public: union Value { @@ -287,7 +267,9 @@ public: bool parse() { return parse(T_FEED_UI_PROGRAM); } bool parseStatement() { return parse(T_FEED_JS_STATEMENT); } bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } + bool parseSourceElement() { return parse(T_FEED_JS_SOURCE_ELEMENT); } bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); } + bool parseProgram() { return parse(T_FEED_JS_PROGRAM); } AST::UiProgram *ast() const { return AST::cast<AST::UiProgram *>(program); } @@ -316,6 +298,9 @@ public: return program->uiObjectMemberCast(); } + AST::Node *rootNode() const + { return program; } + QList<DiagnosticMessage> diagnosticMessages() const { return diagnostic_messages; } @@ -561,6 +546,14 @@ case $rule_number: { } break; ./ +TopLevel: T_FEED_JS_SOURCE_ELEMENT SourceElement ; +/. +case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; +./ + TopLevel: T_FEED_UI_OBJECT_MEMBER UiObjectMember ; /. case $rule_number: { @@ -569,6 +562,14 @@ case $rule_number: { } break; ./ +TopLevel: T_FEED_JS_PROGRAM Program ; +/. +case $rule_number: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; +./ + UiProgram: UiImportListOpt UiRootMember ; /. case $rule_number: { @@ -2885,13 +2886,12 @@ case $rule_number: { } break; ./ ---QmlJSProgram: SourceElements ; ---/. ---case $rule_number: { --- sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); --- driver->changeAbstractSyntaxTree(sym(1).Node); ---} break; ---./ +Program: SourceElements ; +/. +case $rule_number: { + sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); +} break; +./ SourceElements: SourceElement ; /. @@ -2985,7 +2985,12 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ; token_buffer[1].loc = yylloc = location(lexer); if (t_action(errorState, yytoken)) { - const QString msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token])); + QString msg; + int token = token_buffer[0].token; + if (token < 0 || token >= TERMINAL_COUNT) + msg = qApp->translate("QmlParser", "Syntax error"); + else + msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); action = errorState; @@ -3031,7 +3036,8 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ; for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM || - tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION) + tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION || + tk == T_FEED_JS_SOURCE_ELEMENT) continue; int a = t_action(errorState, tk); diff --git a/src/declarative/qml/parser/qmljsast.cpp b/src/declarative/qml/parser/qmljsast.cpp index 2a39aae..e80b05e 100644 --- a/src/declarative/qml/parser/qmljsast.cpp +++ b/src/declarative/qml/parser/qmljsast.cpp @@ -798,7 +798,6 @@ void DebuggerStatement::accept0(Visitor *visitor) visitor->endVisit(this); } - void UiProgram::accept0(Visitor *visitor) { if (visitor->visit(this)) { diff --git a/src/declarative/qml/parser/qmljsgrammar.cpp b/src/declarative/qml/parser/qmljsgrammar.cpp index b8c6560..b416959 100644 --- a/src/declarative/qml/parser/qmljsgrammar.cpp +++ b/src/declarative/qml/parser/qmljsgrammar.cpp @@ -1,4 +1,3 @@ -// This file was generated by qlalr - DO NOT EDIT! /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). @@ -40,8 +39,11 @@ ** ****************************************************************************/ +// This file was generated by qlalr - DO NOT EDIT! #include "qmljsgrammar_p.h" +QT_BEGIN_NAMESPACE + const char *const QmlJSGrammar::spell [] = { "end of file", "&", "&&", "&=", "break", "case", "catch", ":", ";", "continue", "default", "delete", "/", "/=", "do", ".", "else", "=", "==", "===", @@ -52,591 +54,580 @@ const char *const QmlJSGrammar::spell [] = { ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch", "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true", "false", "const", "debugger", "reserved word", "multiline string literal", "comment", "public", - "import", "as", 0, 0, 0, 0, 0, 0}; + "import", "as", 0, 0, 0, 0, 0, 0, 0, 0}; -const int QmlJSGrammar::lhs [] = { - 98, 98, 98, 98, 99, 103, 103, 106, 106, 108, - 107, 107, 107, 107, 107, 107, 107, 107, 110, 105, - 104, 113, 113, 114, 114, 115, 115, 112, 102, 102, - 102, 102, 102, 102, 102, 121, 121, 121, 122, 122, - 123, 123, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 111, 111, 111, 111, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 126, 116, 128, 128, 128, 128, 127, 127, 130, - 130, 132, 132, 132, 132, 132, 132, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 133, 133, 133, 133, 133, 134, 134, - 109, 109, 109, 109, 109, 137, 137, 138, 138, 138, - 138, 136, 136, 139, 139, 140, 140, 141, 141, 141, - 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, - 143, 143, 143, 143, 144, 144, 144, 145, 145, 145, - 145, 146, 146, 146, 146, 146, 146, 146, 147, 147, - 147, 147, 147, 147, 148, 148, 148, 148, 148, 149, - 149, 149, 149, 149, 150, 150, 151, 151, 152, 152, - 153, 153, 154, 154, 155, 155, 156, 156, 157, 157, - 158, 158, 159, 159, 160, 160, 161, 161, 131, 131, - 162, 162, 163, 163, 163, 163, 163, 163, 163, 163, - 163, 163, 163, 163, 101, 101, 164, 164, 165, 165, - 166, 166, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 117, 178, 178, - 177, 177, 125, 125, 179, 179, 180, 180, 182, 182, - 181, 183, 186, 184, 184, 187, 185, 185, 118, 119, - 119, 120, 120, 167, 167, 167, 167, 167, 167, 167, - 168, 168, 168, 168, 169, 169, 169, 169, 170, 170, - 171, 173, 188, 188, 191, 191, 189, 189, 192, 190, - 172, 172, 172, 174, 174, 175, 175, 175, 193, 194, - 176, 176, 124, 135, 198, 198, 195, 195, 196, 196, - 199, 200, 200, 201, 201, 197, 197, 129, 129, 202}; +const short QmlJSGrammar::lhs [] = { + 100, 100, 100, 100, 100, 100, 101, 107, 107, 110, + 110, 112, 111, 111, 111, 111, 111, 111, 111, 111, + 114, 109, 108, 117, 117, 118, 118, 119, 119, 116, + 105, 105, 105, 105, 105, 105, 105, 125, 125, 125, + 126, 126, 127, 127, 105, 105, 105, 105, 105, 105, + 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 105, 105, 115, 115, 115, 115, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 120, 132, 132, 132, 132, 131, + 131, 134, 134, 136, 136, 136, 136, 136, 136, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 138, 138, 113, 113, 113, 113, 113, 141, 141, 142, + 142, 142, 142, 140, 140, 143, 143, 144, 144, 145, + 145, 145, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 147, 147, 147, 147, 148, 148, 148, 149, + 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, + 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, + 152, 153, 153, 153, 153, 153, 154, 154, 155, 155, + 156, 156, 157, 157, 158, 158, 159, 159, 160, 160, + 161, 161, 162, 162, 163, 163, 164, 164, 165, 165, + 135, 135, 166, 166, 167, 167, 167, 167, 167, 167, + 167, 167, 167, 167, 167, 167, 103, 103, 168, 168, + 169, 169, 170, 170, 102, 102, 102, 102, 102, 102, + 102, 102, 102, 102, 102, 102, 102, 102, 102, 121, + 182, 182, 181, 181, 129, 129, 183, 183, 184, 184, + 186, 186, 185, 187, 190, 188, 188, 191, 189, 189, + 122, 123, 123, 124, 124, 171, 171, 171, 171, 171, + 171, 171, 172, 172, 172, 172, 173, 173, 173, 173, + 174, 174, 175, 177, 192, 192, 195, 195, 193, 193, + 196, 194, 176, 176, 176, 178, 178, 179, 179, 179, + 197, 198, 180, 180, 128, 139, 202, 202, 199, 199, + 200, 200, 203, 106, 204, 204, 104, 104, 201, 201, + 133, 133, 205}; -const int QmlJSGrammar:: rhs[] = { - 2, 2, 2, 2, 2, 1, 1, 1, 2, 1, - 2, 2, 3, 3, 5, 5, 4, 4, 2, 0, - 1, 1, 2, 1, 3, 2, 3, 2, 1, 5, - 4, 3, 3, 3, 3, 1, 1, 1, 0, 1, - 2, 4, 6, 6, 3, 3, 7, 7, 4, 4, - 5, 5, 6, 6, 7, 7, 7, 7, 1, 1, +const short QmlJSGrammar::rhs [] = { + 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, + 2, 1, 2, 2, 3, 3, 5, 5, 4, 4, + 2, 0, 1, 1, 2, 1, 3, 2, 3, 2, + 1, 5, 4, 3, 3, 3, 3, 1, 1, 1, + 0, 1, 2, 4, 6, 6, 3, 3, 7, 7, + 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 3, 3, 4, 5, 3, - 4, 3, 1, 1, 2, 3, 4, 1, 2, 3, - 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, + 5, 3, 4, 3, 1, 1, 2, 3, 4, 1, + 2, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 4, 3, 5, 1, 2, 4, 4, 4, - 3, 0, 1, 1, 3, 1, 1, 1, 2, 2, - 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, - 3, 1, 3, 3, 3, 3, 3, 3, 1, 3, - 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, - 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, + 1, 1, 1, 1, 4, 3, 5, 1, 2, 4, + 4, 4, 3, 0, 1, 1, 3, 1, 1, 1, + 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 1, 3, 3, 3, 1, 3, 3, 1, + 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, + 1, 3, 3, 3, 3, 3, 1, 3, 3, 3, + 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, - 1, 3, 1, 3, 1, 5, 1, 5, 1, 3, - 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 0, 1, 1, 3, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 1, 2, - 0, 1, 3, 3, 1, 1, 1, 3, 1, 3, - 2, 2, 2, 0, 1, 2, 0, 1, 1, 2, - 2, 7, 5, 7, 7, 5, 9, 10, 7, 8, - 2, 2, 3, 3, 2, 2, 3, 3, 3, 3, - 5, 5, 3, 5, 1, 2, 0, 1, 4, 3, - 3, 3, 3, 3, 3, 3, 3, 4, 5, 2, - 2, 2, 8, 8, 1, 3, 0, 1, 0, 1, - 1, 1, 2, 1, 1, 0, 1, 0, 1, 2}; + 1, 3, 1, 3, 1, 3, 1, 5, 1, 5, + 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 3, 0, 1, + 1, 3, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 1, 2, 0, 1, 3, 3, 1, 1, 1, 3, + 1, 3, 2, 2, 2, 0, 1, 2, 0, 1, + 1, 2, 2, 7, 5, 7, 7, 5, 9, 10, + 7, 8, 2, 2, 3, 3, 2, 2, 3, 3, + 3, 3, 5, 5, 3, 5, 1, 2, 0, 1, + 4, 3, 3, 3, 3, 3, 3, 3, 3, 4, + 5, 2, 2, 2, 8, 8, 1, 3, 0, 1, + 0, 1, 1, 1, 1, 2, 1, 1, 0, 1, + 0, 1, 2}; -const int QmlJSGrammar::action_default [] = { - 0, 0, 0, 0, 20, 0, 168, 235, 199, 207, - 203, 147, 219, 195, 3, 132, 66, 148, 211, 215, - 136, 165, 146, 151, 131, 185, 172, 0, 73, 74, - 69, 336, 61, 338, 0, 0, 0, 0, 71, 0, - 0, 67, 70, 0, 0, 62, 64, 63, 72, 65, - 0, 68, 0, 0, 161, 0, 0, 148, 167, 150, - 149, 0, 0, 0, 163, 164, 162, 166, 0, 196, - 0, 0, 0, 0, 186, 0, 0, 0, 0, 0, - 0, 176, 0, 0, 0, 170, 171, 169, 174, 178, - 177, 175, 173, 188, 187, 189, 0, 204, 0, 200, - 0, 0, 142, 129, 141, 130, 98, 99, 100, 125, - 101, 126, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 127, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 128, 0, 0, 140, - 236, 143, 0, 144, 0, 145, 139, 0, 232, 225, - 223, 230, 231, 229, 228, 234, 227, 226, 224, 233, - 220, 0, 208, 0, 0, 212, 0, 0, 216, 0, - 0, 142, 134, 0, 133, 0, 138, 152, 0, 337, - 327, 328, 0, 325, 0, 326, 0, 329, 243, 250, - 249, 257, 245, 0, 246, 330, 0, 335, 247, 248, - 253, 251, 332, 331, 334, 254, 0, 265, 0, 0, - 0, 0, 336, 61, 0, 338, 62, 237, 279, 63, - 0, 0, 0, 266, 0, 0, 255, 256, 0, 244, - 252, 280, 281, 324, 333, 0, 295, 296, 297, 298, - 0, 291, 292, 293, 294, 321, 322, 0, 0, 0, - 0, 0, 284, 285, 241, 239, 201, 209, 205, 221, - 197, 242, 0, 148, 213, 217, 190, 179, 0, 0, - 198, 0, 0, 0, 0, 191, 0, 0, 0, 0, - 0, 183, 181, 184, 182, 180, 193, 192, 194, 0, - 206, 0, 202, 0, 240, 148, 0, 222, 237, 238, - 0, 237, 0, 0, 287, 0, 0, 0, 289, 0, - 210, 0, 0, 214, 0, 0, 218, 277, 0, 269, - 278, 272, 0, 276, 0, 237, 270, 0, 237, 0, - 0, 288, 0, 0, 0, 290, 337, 327, 0, 0, - 329, 0, 323, 0, 313, 0, 0, 0, 283, 0, - 282, 0, 339, 0, 97, 259, 262, 0, 98, 265, - 101, 126, 103, 104, 69, 108, 109, 61, 110, 113, - 67, 70, 62, 237, 63, 72, 116, 65, 118, 68, - 120, 121, 266, 123, 124, 128, 0, 90, 0, 0, - 92, 96, 94, 81, 93, 95, 0, 91, 80, 260, - 258, 136, 137, 142, 0, 135, 0, 312, 0, 299, - 300, 0, 311, 0, 0, 0, 302, 307, 305, 308, - 0, 0, 306, 307, 0, 303, 0, 304, 261, 310, - 0, 261, 309, 0, 314, 315, 0, 261, 316, 317, - 0, 0, 318, 0, 0, 0, 319, 320, 154, 153, - 0, 0, 0, 286, 0, 0, 0, 301, 274, 267, - 0, 275, 271, 0, 273, 263, 0, 264, 268, 84, - 0, 0, 88, 75, 0, 77, 86, 0, 78, 87, - 89, 79, 85, 76, 0, 82, 158, 156, 160, 157, - 155, 159, 2, 59, 83, 0, 0, 62, 64, 63, - 29, 4, 0, 60, 0, 38, 37, 36, 0, 0, - 51, 0, 52, 0, 57, 58, 0, 38, 0, 0, - 0, 0, 0, 47, 48, 0, 49, 0, 50, 0, - 53, 54, 0, 0, 0, 0, 0, 55, 56, 0, - 45, 39, 46, 40, 0, 0, 0, 0, 42, 0, - 43, 44, 41, 0, 0, 28, 32, 33, 34, 35, - 136, 261, 0, 0, 98, 265, 101, 126, 103, 104, - 69, 108, 109, 61, 110, 113, 67, 70, 62, 237, - 63, 72, 116, 65, 118, 68, 120, 121, 266, 123, - 124, 128, 136, 0, 24, 0, 0, 30, 25, 31, - 26, 22, 0, 27, 23, 6, 0, 8, 0, 7, - 0, 1, 19, 10, 0, 11, 0, 12, 0, 17, - 18, 0, 13, 14, 0, 15, 16, 9, 21, 5, - 340}; +const short QmlJSGrammar::action_default [] = { + 0, 0, 0, 0, 0, 0, 22, 0, 170, 237, + 201, 209, 205, 149, 221, 197, 3, 134, 68, 150, + 213, 217, 138, 167, 148, 153, 133, 187, 174, 0, + 75, 76, 71, 339, 63, 341, 0, 0, 0, 0, + 73, 0, 0, 69, 72, 0, 0, 64, 66, 65, + 74, 67, 0, 70, 0, 0, 163, 0, 0, 150, + 169, 152, 151, 0, 0, 0, 165, 166, 164, 168, + 0, 198, 0, 0, 0, 0, 188, 0, 0, 0, + 0, 0, 0, 178, 0, 0, 0, 172, 173, 171, + 176, 180, 179, 177, 175, 190, 189, 191, 0, 206, + 0, 202, 0, 0, 144, 131, 143, 132, 100, 101, + 102, 127, 103, 128, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 129, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 130, 0, + 0, 142, 238, 145, 0, 146, 0, 147, 141, 0, + 234, 227, 225, 232, 233, 231, 230, 236, 229, 228, + 226, 235, 222, 0, 210, 0, 0, 214, 0, 0, + 218, 0, 0, 144, 136, 0, 135, 0, 140, 154, + 0, 340, 329, 330, 0, 327, 0, 328, 0, 331, + 245, 252, 251, 259, 247, 0, 248, 332, 0, 338, + 249, 250, 255, 253, 335, 333, 337, 256, 0, 267, + 0, 0, 0, 0, 339, 63, 0, 341, 64, 239, + 281, 65, 0, 0, 0, 268, 0, 0, 257, 258, + 0, 246, 254, 282, 283, 326, 336, 0, 297, 298, + 299, 300, 0, 293, 294, 295, 296, 323, 324, 0, + 0, 0, 0, 0, 286, 287, 243, 241, 203, 211, + 207, 223, 199, 244, 0, 150, 215, 219, 192, 181, + 0, 0, 200, 0, 0, 0, 0, 193, 0, 0, + 0, 0, 0, 185, 183, 186, 184, 182, 195, 194, + 196, 0, 208, 0, 204, 0, 242, 150, 0, 224, + 239, 240, 0, 239, 0, 0, 289, 0, 0, 0, + 291, 0, 212, 0, 0, 216, 0, 0, 220, 279, + 0, 271, 280, 274, 0, 278, 0, 239, 272, 0, + 239, 0, 0, 290, 0, 0, 0, 292, 340, 329, + 0, 0, 331, 0, 325, 0, 315, 0, 0, 0, + 285, 0, 284, 0, 342, 0, 99, 261, 264, 0, + 100, 267, 103, 128, 105, 106, 71, 110, 111, 63, + 112, 115, 69, 72, 64, 239, 65, 74, 118, 67, + 120, 70, 122, 123, 268, 125, 126, 130, 0, 92, + 0, 0, 94, 98, 96, 83, 95, 97, 0, 93, + 82, 262, 260, 138, 139, 144, 0, 137, 0, 314, + 0, 301, 302, 0, 313, 0, 0, 0, 304, 309, + 307, 310, 0, 0, 308, 309, 0, 305, 0, 306, + 263, 312, 0, 263, 311, 0, 316, 317, 0, 263, + 318, 319, 0, 0, 320, 0, 0, 0, 321, 322, + 156, 155, 0, 0, 0, 288, 0, 0, 0, 303, + 276, 269, 0, 277, 273, 0, 275, 265, 0, 266, + 270, 86, 0, 0, 90, 77, 0, 79, 88, 0, + 80, 89, 91, 81, 87, 78, 0, 84, 160, 158, + 162, 159, 157, 161, 6, 334, 4, 2, 61, 85, + 0, 0, 64, 66, 65, 31, 5, 0, 62, 0, + 40, 39, 38, 0, 0, 53, 0, 54, 0, 59, + 60, 0, 40, 0, 0, 0, 0, 0, 49, 50, + 0, 51, 0, 52, 0, 55, 56, 0, 0, 0, + 0, 0, 57, 58, 0, 47, 41, 48, 42, 0, + 0, 0, 0, 44, 0, 45, 46, 43, 0, 0, + 30, 34, 35, 36, 37, 138, 263, 0, 0, 100, + 267, 103, 128, 105, 106, 71, 110, 111, 63, 112, + 115, 69, 72, 64, 239, 65, 74, 118, 67, 120, + 70, 122, 123, 268, 125, 126, 130, 138, 0, 26, + 0, 0, 32, 27, 33, 28, 24, 0, 29, 25, + 8, 0, 10, 0, 9, 0, 1, 21, 12, 0, + 13, 0, 14, 0, 19, 20, 0, 15, 16, 0, + 17, 18, 11, 23, 7, 343}; -const int QmlJSGrammar::goto_default [] = { - 5, 611, 355, 193, 501, 610, 629, 605, 609, 607, - 612, 20, 608, 16, 500, 602, 593, 555, 502, 188, - 192, 194, 198, 518, 544, 543, 197, 229, 24, 471, - 470, 353, 352, 7, 351, 354, 104, 15, 142, 22, - 11, 141, 17, 23, 54, 21, 6, 26, 25, 266, - 13, 260, 8, 256, 10, 258, 9, 257, 18, 264, - 19, 265, 12, 259, 255, 296, 408, 261, 262, 199, - 190, 189, 201, 230, 200, 205, 226, 227, 191, 357, - 356, 228, 460, 459, 318, 319, 462, 321, 461, 320, - 416, 420, 423, 419, 418, 438, 439, 182, 196, 178, - 181, 195, 203, 202, 0}; +const short QmlJSGrammar::goto_default [] = { + 7, 616, 206, 195, 204, 506, 494, 615, 634, 610, + 614, 612, 617, 22, 613, 18, 505, 607, 598, 560, + 507, 190, 194, 196, 200, 523, 549, 548, 199, 231, + 26, 473, 472, 355, 354, 9, 353, 356, 106, 17, + 144, 24, 13, 143, 19, 25, 56, 23, 8, 28, + 27, 268, 15, 262, 10, 258, 12, 260, 11, 259, + 20, 266, 21, 267, 14, 261, 257, 298, 410, 263, + 264, 201, 192, 191, 203, 232, 202, 207, 228, 229, + 193, 359, 358, 230, 462, 461, 320, 321, 464, 323, + 463, 322, 418, 422, 425, 421, 420, 440, 441, 184, + 198, 180, 183, 197, 205, 0}; -const int QmlJSGrammar::action_index [] = { - 251, 1237, 2238, 974, -45, 51, 122, -98, 52, -11, - -39, 182, -98, 389, 36, -98, -98, 628, 58, 75, - 246, 228, -98, -98, -98, 438, 309, 1237, -98, -98, - -98, 348, -98, 2050, 1772, 1237, 1237, 1237, -98, 800, - 1237, -98, -98, 1237, 1237, -98, -98, -98, -98, -98, - 1237, -98, 1237, 1237, -98, 1237, 1237, 97, 226, -98, - -98, 1237, 1237, 1237, -98, -98, -98, 200, 1237, 389, - 1237, 1237, 1237, 1237, 418, 1237, 1237, 1237, 1237, 1237, - 1237, 212, 1237, 1237, 1237, 144, 121, 71, 309, 309, - 164, 156, 179, 448, 428, 408, 1237, -51, 1237, 101, - 1956, 1237, 1237, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, 236, 1237, -98, - -98, 31, 16, -98, 1237, -98, -98, 1237, -98, -98, - -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, 1237, 2, 1237, 1237, 41, 35, 1237, -98, 1956, - 1237, 1237, -98, 102, -98, 6, -98, -98, 20, -98, - 299, 53, 14, -98, 321, -98, -22, 2332, -98, -98, - -98, -98, -98, 216, -98, -98, -28, -98, -98, -98, - -98, -98, -98, 2332, -98, -98, 469, -98, 533, 115, - 2238, -2, 335, -3, -36, 2520, 50, 1237, -98, 64, - 33, 1237, 21, -98, 5, -14, -98, -98, 306, -98, - -98, -98, -98, -98, -98, 74, -98, -98, -98, -98, - 117, -98, -98, -98, -98, -98, -98, -57, -18, 1237, - 140, 109, -98, -98, 1324, -98, 104, 67, 27, -98, - 330, 84, 29, 585, 80, 92, 464, 171, 295, 1237, - 314, 1237, 1237, 1237, 1237, 346, 1237, 1237, 1237, 1237, - 1237, 309, 309, 309, 309, 309, 386, 464, 464, 1237, - 27, 1237, 87, 1237, -98, 529, 1237, -98, 1237, 83, - 38, 1237, 48, 2238, -98, 1237, 143, 2238, -98, 1237, - 30, 1237, 1237, 81, 77, 1237, -98, 56, 126, 90, - -98, -98, 1237, -98, 290, 1237, -98, 42, 1237, 44, - 2238, -98, 1237, 133, 2238, -98, 22, 285, -37, -9, - 2332, -30, -98, 2238, -98, 1237, 141, 2238, 10, 2238, - -98, 26, 24, -24, -98, -98, 2238, 25, 453, 23, - 533, 106, 1237, 2238, 9, -29, 361, -4, -31, 800, - -6, 55, -98, 1415, -98, -1, -23, 8, 1237, 7, - -21, 1237, 1, 1237, -27, -19, 1237, -98, 2144, 28, - -98, -98, -98, -98, -98, -98, 1237, -98, -98, -98, - -98, 211, -98, 1237, 17, -98, 2238, -98, 98, -98, - -98, 2238, -98, 1237, 105, 37, -98, 63, -98, 62, - 99, 1237, -98, 60, 57, -98, 4, -98, 2238, -98, - 116, 2238, -98, 180, -98, -98, 112, 2238, 18, -98, - 11, 13, -98, 325, 3, 19, -98, -98, -98, -98, - 1237, 132, 2238, -98, 1237, 139, 2238, -98, 32, -98, - 174, -98, -98, 1237, -98, -98, 229, -98, -98, -98, - 108, 1682, -98, -98, 1862, -98, -98, 1505, -98, -98, - -98, -98, -98, -98, 125, -98, -98, -98, -98, -98, - -98, -98, -98, -98, 111, 46, 792, 184, 34, 85, - -98, -98, 136, -98, 185, -98, -98, -98, 65, 204, - -98, 1237, -98, 207, -98, -98, 193, 61, 43, 225, - 73, 88, 66, -98, -98, 214, -98, 1237, -98, 158, - -98, -98, 181, 91, 72, 1237, 172, -98, -98, 187, - -98, 157, -98, 47, -50, 274, 178, 250, -98, 113, - -98, -98, -98, 1592, 1062, -98, -98, -98, -98, -98, - 271, 2426, 1772, 15, 461, 146, 445, 76, 1237, 2238, - -5, 0, 370, 12, -15, 706, 89, 78, -98, 1415, - -98, 100, 59, 82, 1237, 86, 54, 1237, 79, 1237, - 45, 39, 279, 149, -98, 68, 617, -98, -98, -98, - -98, -98, 1150, -98, -98, -98, 886, -98, 240, -61, - 714, -98, -98, 129, 259, -98, 190, -98, 69, -98, - -98, 255, -98, -98, 94, -98, -98, -98, -98, -98, - -98, +const short QmlJSGrammar::action_index [] = { + 439, 1109, 2228, 2228, 2132, 814, -74, 18, 147, -100, + 31, -17, -49, 232, -100, 318, 85, -100, -100, 554, + 33, 94, 331, 215, -100, -100, -100, 448, 231, 1109, + -100, -100, -100, 320, -100, 1940, 1472, 1109, 1109, 1109, + -100, 724, 1109, -100, -100, 1109, 1109, -100, -100, -100, + -100, -100, 1109, -100, 1109, 1109, -100, 1109, 1109, 129, + 157, -100, -100, 1109, 1109, 1109, -100, -100, -100, 200, + 1109, 293, 1109, 1109, 1109, 1109, 466, 1109, 1109, 1109, + 1109, 1109, 1109, 179, 1109, 1109, 1109, 119, 125, 95, + 188, 198, 184, 203, 178, 567, 567, 484, 1109, -5, + 1109, 67, 1844, 1109, 1109, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, -100, -100, -100, -100, -100, -100, 110, + 1109, -100, -100, 70, 61, -100, 1109, -100, -100, 1109, + -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, + -100, -100, -100, 1109, 55, 1109, 1109, 73, 63, 1109, + -100, 1844, 1109, 1109, -100, 141, -100, 41, -100, -100, + 87, -100, 255, 80, 78, -100, 287, -100, 83, 2228, + -100, -100, -100, -100, -100, 225, -100, -100, 52, -100, + -100, -100, -100, -100, -100, 2228, -100, -100, 420, -100, + 408, 113, 2132, 50, 330, 65, 46, 2420, 72, 1109, + -100, 74, 75, 1109, 77, -100, 53, 56, -100, -100, + 323, -100, -100, -100, -100, -100, -100, 96, -100, -100, + -100, -100, 99, -100, -100, -100, -100, -100, -100, 60, + 47, 1109, 118, 93, -100, -100, 1291, -100, 79, 66, + 64, -100, 413, 76, 51, 664, 89, 97, 393, 183, + 337, 1109, 413, 1109, 1109, 1109, 1109, 411, 1109, 1109, + 1109, 1109, 1109, 252, 272, 212, 217, 221, 490, 490, + 383, 1109, 64, 1109, 84, 1109, -100, 536, 1109, -100, + 1109, 69, 68, 1109, 44, 2132, -100, 1109, 124, 2132, + -100, 1109, 54, 1109, 1109, 71, 88, 1109, -100, 82, + 122, 154, -100, -100, 1109, -100, 343, 1109, -100, 81, + 1109, 90, 2132, -100, 1109, 112, 2132, -100, 86, 333, + -39, -10, 2228, -33, -100, 2132, -100, 1109, 246, 2132, + 4, 2132, -100, 10, 16, -21, -100, -100, 2132, -26, + 480, 19, 462, 128, 1109, 2132, 6, -9, 400, 8, + -22, 840, -3, -6, -100, 1202, -100, -7, -28, 5, + 1109, 2, -23, 1109, 0, 1109, -34, -30, 1109, -100, + 2036, 21, -100, -100, -100, -100, -100, -100, 1109, -100, + -100, -100, -100, 209, -100, 1109, 40, -100, 2132, -100, + 101, -100, -100, 2132, -100, 1109, 120, 43, -100, 62, + -100, 59, 109, 1109, -100, 57, 58, -100, 39, -100, + 2132, -100, 117, 2132, -100, 199, -100, -100, 107, 2132, + 34, -100, 24, 11, -100, 346, -19, 14, -100, -100, + -100, -100, 1109, 133, 2132, -100, 1109, 126, 2132, -100, + 20, -100, 173, -100, -100, 1109, -100, -100, 303, -100, + -100, -100, 100, 1656, -100, -100, 1564, -100, -100, 1748, + -100, -100, -100, -100, -100, -100, 131, -100, -100, -100, + -100, -100, -100, -100, -100, 2228, -100, -100, -100, 158, + -20, 752, 165, -16, 22, -100, -100, 98, -100, 189, + -100, -100, -100, 28, 170, -100, 1109, -100, 230, -100, + -100, 247, 1, 13, 238, 37, -24, 106, -100, -100, + 273, -100, 1109, -100, 265, -100, -100, 242, -4, 12, + 1109, 241, -100, -100, 234, -100, 245, -100, 3, 9, + 311, 190, 316, -100, 134, -100, -100, -100, 1380, 1020, + -100, -100, -100, -100, -100, 359, 2324, 1472, 15, 444, + 38, 394, 138, 1109, 2132, 36, 17, 397, 42, 23, + 840, 32, 29, -100, 1202, -100, 26, 35, 48, 1109, + 45, 25, 1109, 49, 1109, 27, 30, 314, 132, -100, + 7, 752, -100, -100, -100, -100, -100, 930, -100, -100, + -100, 752, -100, 253, -87, 617, -100, -100, 102, 290, + -100, 191, -100, 140, -100, -100, 275, -100, -100, 91, + -100, -100, -100, -100, -100, -100, - -105, 23, 25, 216, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -44, -105, -105, - -105, -105, -105, -105, -105, -105, -105, 70, -105, -105, - -105, 28, -105, -105, 20, 39, 97, 163, -105, 178, - 159, -105, -105, 156, 164, -105, -105, -105, -105, -105, - 132, -105, 153, 135, -105, 139, 140, -105, -105, -105, - -105, 103, 92, 144, -105, -105, -105, -105, 125, -105, - 154, 162, 83, 84, -105, 88, 82, 81, 75, 66, - 122, -105, 116, 98, 104, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, 106, -105, 113, -105, - 86, 80, 52, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, 34, -105, - -105, -105, -105, -105, 38, -105, -105, 43, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, 136, -105, 91, -29, -105, -105, 3, -105, 225, - 37, 71, -105, -105, -105, -105, -105, -105, -105, -105, - -3, -105, -105, -105, 18, -105, -105, 27, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, 87, -105, -105, 62, -105, 56, -105, - 50, -105, 31, -105, -105, -105, -105, 59, -105, -105, - -105, 47, 69, -105, -105, -105, -105, -105, 67, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, 30, - -105, -105, -105, -105, 96, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, 10, 184, - -105, 222, 226, 232, 202, -105, 124, 114, 112, 110, - 95, -105, -105, -105, -105, -105, -105, -105, -105, 212, - -105, 192, -105, 177, -105, -105, 208, -105, 107, -105, - -105, 255, -105, 11, -105, 13, -105, 44, -105, 206, - -105, 169, 176, -105, -105, 183, -105, -105, -105, -105, - -105, -105, 173, -105, 167, 117, -105, -105, 191, -105, - 54, -105, 55, -105, 58, -105, -105, 102, -105, -105, - 89, -105, -105, 57, -105, 46, -105, 45, -105, 49, - -105, -105, -105, -105, -105, -105, 77, -105, 64, -105, - 51, -105, 109, 61, -105, -105, 48, -105, -105, 152, - -105, -105, -105, 79, -105, -105, -105, -105, 4, -105, - -16, 153, -105, 74, -105, -105, -11, -105, 0, -105, - -105, -105, -105, -105, -105, -105, -5, -105, -105, -105, - -105, -105, -105, 68, -105, -105, 41, -105, -105, -105, - -105, 90, -105, -1, -105, -105, -105, -105, -105, -93, - -105, 32, -105, -4, -105, -105, -105, -105, -22, -105, - -105, -14, -105, -105, -105, -105, -105, -105, -26, -105, - -105, -2, -105, 60, -105, 53, -105, -105, -105, -105, - 65, -105, 76, -105, 78, -105, 72, -105, -105, -105, - -105, -105, -105, 21, -105, -105, 85, -105, -105, -105, - -105, 22, -105, -105, 180, -105, -105, 33, -105, -105, - -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, - -105, -105, -105, -105, -105, -105, 73, -105, -105, -105, - -105, -105, -105, -105, 63, -105, -105, -105, -105, -105, - -105, 12, -105, -105, -105, -105, -105, -105, -105, -12, - -105, -105, -105, -105, -105, -105, -105, 6, -105, -105, - -105, -105, -15, -105, -105, 9, -105, -105, -105, -105, - -105, -9, -105, -105, -105, -7, -18, -13, -105, -105, - -105, -105, -105, 277, 266, -105, -105, -105, -105, -105, - -105, -105, 269, 2, 26, -105, 24, -105, 170, 16, - -105, -105, 19, -105, -105, 182, -105, -105, -105, 35, - -105, -105, -105, -105, 42, -105, 29, 153, -105, 128, - -105, -105, -105, -105, -105, -105, 349, -105, -105, -105, - -105, -105, 274, -105, -105, -105, 14, -105, -105, 15, - 218, -105, -105, -105, 7, -105, -105, -105, -105, -105, - -105, 17, -105, -105, -105, -105, -105, -105, -105, -105, - -105}; + -106, 12, -87, 18, 17, 212, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -53, + -106, -106, -106, -106, -106, -106, -106, -106, -106, 162, + -106, -106, -106, -4, -106, -106, -11, 24, 75, 76, + -106, 83, 55, -106, -106, 157, 158, -106, -106, -106, + -106, -106, 150, -106, 172, 176, -106, 168, 167, -106, + -106, -106, -106, 173, 154, 115, -106, -106, -106, -106, + 147, -106, 121, 113, 112, 125, -106, 128, 143, 146, + 140, 139, 136, -106, 122, 138, 130, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, 149, -106, + 153, -106, 110, 82, 46, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + 35, -106, -106, -106, -106, -106, 37, -106, -106, 45, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, 92, -106, 88, 58, -106, -106, 51, + -106, 209, 72, 78, -106, -106, -106, -106, -106, -106, + -106, -106, 27, -106, -106, -106, 63, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, 50, -106, -106, 28, -106, + 29, -106, 47, -106, 33, -106, -106, 66, -106, 73, + -106, -106, -106, 81, 53, -106, -106, -106, -106, -106, + -13, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, 9, -106, -106, -106, -106, 111, -106, -106, -106, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + 3, 186, -106, 220, 228, 234, 204, -106, 90, 91, + 94, 97, 93, -106, -106, -106, -106, -106, -106, -106, + -106, 210, -106, 187, -106, 214, -106, -106, 208, -106, + 207, -106, -106, 155, -106, 8, -106, 4, -106, -1, + -106, 217, -106, 177, 185, -106, -106, 184, -106, -106, + -106, -106, -106, -106, 183, -106, 194, 105, -106, -106, + 99, -106, 71, -106, 74, -106, 65, -106, -106, 114, + -106, -106, -55, -106, -106, 64, -106, 44, -106, 30, + -106, 31, -106, -106, -106, -106, -106, -106, 57, -106, + 36, -106, 40, -106, 70, 59, -106, -106, 42, -106, + -106, 104, -106, -106, -106, 38, -106, -106, -106, -106, + 79, -106, 69, 108, -106, 84, -106, -106, 56, -106, + 68, -106, -106, -106, -106, -106, -106, -106, 52, -106, + -106, -106, -106, -106, -106, 109, -106, -106, 77, -106, + -106, -106, -106, 86, -106, 80, -106, -106, -106, -106, + -106, -59, -106, 43, -106, -63, -106, -106, -106, -106, + 98, -106, -106, 95, -106, -106, -106, -106, -106, 60, + -34, -106, -106, 32, -106, 41, -106, 39, -106, -106, + -106, -106, 49, -106, 61, -106, 62, -106, 48, -106, + -106, -106, -106, -106, -106, 23, -106, -106, 96, -106, + -106, -106, -106, 34, -106, -106, 133, -106, -106, 54, + -106, -106, -106, -106, -106, -106, -106, -106, -106, -106, + -106, -106, -106, -106, -106, 67, -106, -106, -106, -106, + -106, 22, -106, -106, -106, -106, -106, -106, -106, -22, + -106, -106, -106, -106, -106, -106, 2, -106, -106, -106, + -106, -106, -106, -106, -19, -106, -106, -106, -106, -106, + -106, -106, 100, -106, -106, -106, -106, -21, -106, -106, + -3, -106, -106, -106, -106, -106, 13, -106, -106, -106, + 11, 14, 10, -106, -106, -106, -106, -106, 279, 283, + -106, -106, -106, -106, -106, -106, 19, 273, 15, 16, + -106, 21, -106, 224, 6, -106, -106, 25, -106, -106, + 85, -106, -106, -106, 26, -106, -106, -106, -106, 20, + -106, 7, 87, -106, 107, -106, -106, -106, -106, -106, + -106, 317, -106, -106, -106, -106, -106, 277, -106, -106, + -106, 0, -106, -106, -2, 271, -106, -106, -106, 1, + -106, -106, -106, -106, -106, -106, 5, -106, -106, -106, + -106, -106, -106, -106, -106, -106}; -const int QmlJSGrammar::action_info [] = { - 345, -114, -106, -92, 343, 345, -95, 254, -122, 450, - 549, 187, 437, 413, -119, -117, -106, 454, 249, -92, - 248, 345, 454, 339, 340, 342, 349, 233, 98, 606, - -125, 398, 388, 386, 254, 396, 254, 96, 441, 144, - 98, 450, 167, 161, 138, 606, 437, 443, 554, 463, - 96, 630, 437, 68, 437, 546, 180, 406, 337, 427, - 161, 184, -96, 445, 428, 421, 176, 421, 421, 413, - 417, 411, 525, 322, 186, 454, 146, 405, 289, 535, - 400, 450, 309, 309, 315, -96, -122, 437, 269, -117, - 298, 138, 293, -119, 509, 413, -114, 521, 519, 301, - 532, 554, 68, 328, 330, 269, 291, -95, 303, 424, - 138, 55, 504, 138, 539, 289, 474, 522, 440, 0, - 534, 332, 56, 431, 138, 163, 169, 524, 523, 164, - 620, 619, 441, 138, 324, 239, 238, 246, 245, 59, - 138, 138, 311, 553, 169, 170, 312, 138, 138, 138, - 60, 138, 0, -125, 425, 626, 625, 596, 174, 410, - 409, 55, 55, 170, 475, 415, 138, 246, 245, 554, - 253, 252, 56, 56, 551, 550, 246, 245, 244, 243, - 138, 82, 466, 83, 55, 485, 505, 325, 138, 82, - 0, 83, 452, 334, 84, 56, 82, 100, 83, 456, - 251, 347, 84, 307, 82, 597, 83, 505, 169, 84, - 505, 511, 61, 517, 505, 138, 101, 84, 102, 531, - 530, 527, 0, 541, 138, 0, 169, 170, 0, 403, - 0, 0, 507, 538, 537, 467, 465, 82, 61, 83, - 61, 435, 434, 506, 138, 170, 0, 403, 542, 540, - 84, 623, 622, 507, 505, 0, 507, 62, 32, 507, - 507, 169, 0, 63, 506, 512, 510, 506, 515, 514, - 506, 506, 0, 0, 0, 528, 526, 232, 231, 32, - 170, 621, 171, 62, 32, 62, 169, 616, 32, 63, - 0, 63, 139, 0, 169, 45, 47, 46, 0, 0, - 507, 617, 615, 32, -83, 170, 0, 171, 0, 0, - 0, 506, -83, 170, 32, 171, 45, 47, 46, 32, - 0, 45, 47, 46, 32, 45, 47, 46, 32, 0, - 0, 614, 271, 272, 82, 32, 83, 0, 0, 0, - 45, 47, 46, 4, 3, 2, 1, 84, 271, 272, - 32, 45, 47, 46, 32, 0, 45, 47, 46, 273, - 274, 45, 47, 46, 32, 45, 47, 46, 0, 276, - 277, 0, 45, 47, 46, 273, 274, 32, 278, 0, - 0, 279, 0, 280, 0, 0, 0, 45, 47, 46, - 32, 45, 47, 46, 0, 0, 0, -336, 0, 32, - 0, 45, 47, 46, 0, 0, -336, 70, 71, 276, - 277, 0, 0, 0, 45, 47, 46, 0, 278, 0, - 0, 279, 0, 280, 0, 0, 0, 45, 47, 46, - 0, 75, 76, 0, 72, 73, 45, 47, 46, 77, - 78, 75, 76, 79, 0, 80, 0, 0, 0, 77, - 78, 75, 76, 79, 0, 80, 0, 0, 0, 77, - 78, 75, 76, 79, 0, 80, 0, 0, 0, 77, - 78, 75, 76, 79, 32, 80, 0, 0, 0, 77, - 78, 0, 32, 79, 0, 80, 0, 276, 277, 0, - 32, 0, 0, 0, 0, 0, 278, 0, 32, 279, - 0, 280, 0, 0, 0, 0, 242, 241, 0, 0, - 0, 45, 47, 46, 237, 236, 0, 0, 0, 45, - 47, 46, 237, 236, 0, 0, 0, 45, 47, 46, - 237, 236, 148, 0, 0, 45, 47, 46, 0, 0, - 0, 0, 149, 0, 0, 0, 150, 0, 0, 0, - 0, 0, 0, 0, 0, 151, 0, 152, 0, 0, - 0, 0, 32, 0, 0, 0, 0, 0, 153, 0, - 154, 59, 0, 0, 0, 0, 0, 0, 155, 0, - 0, 156, 60, 0, 0, 0, 0, 157, 148, 0, - 0, 0, 0, 158, 242, 241, 0, 0, 149, 45, - 47, 46, 150, 0, 0, 0, 0, 0, 0, 159, - 0, 151, 0, 152, 0, 0, 305, 0, 0, 0, - 0, 0, 0, 0, 153, 0, 154, 59, 0, 28, - 29, 148, 0, 0, 155, 0, 0, 156, 60, 31, - 0, 149, 0, 157, 0, 150, 32, 0, 0, 158, - 33, 34, 0, 35, 151, 0, 152, 0, 0, 0, - 496, 0, 0, 0, 42, 159, 0, 153, 0, 154, - 59, 0, 0, 0, 0, 0, 0, 155, 0, 0, - 156, 60, 48, 45, 47, 46, 157, 49, 0, 0, - 0, 0, 158, 0, 0, 0, 0, 0, 41, 51, - 30, 0, 0, 0, 38, 0, 0, 0, 159, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 28, 29, - 0, 0, 0, 0, 0, 0, 28, 29, 31, 0, - 0, 0, 0, 0, 0, 32, 31, 0, 0, 33, - 34, 0, 35, 32, 0, 0, 0, 33, 34, 39, - 35, 0, 0, 42, 0, 0, 0, 496, 0, 0, - 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 48, 45, 47, 46, 0, 49, 0, 0, 48, - 45, 47, 46, 0, 49, 0, 0, 41, 51, 30, - 0, 0, 0, 38, 0, 41, 51, 30, 0, 0, - 0, 38, 0, 0, 28, 29, 0, 0, 0, 0, - 0, 0, 28, 29, 31, 0, 0, 0, 0, 0, - 0, 32, 31, 0, 0, 33, 34, 0, 35, 32, - 0, 0, 0, 33, 34, 496, 35, 0, 0, 42, - 0, 0, 0, 39, 0, 0, 0, 42, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 48, 45, 47, - 46, 0, 49, 0, 0, 48, 45, 47, 46, 0, - 49, 0, 0, 41, 51, 30, 0, 0, 0, 38, - 0, 41, 51, 30, 0, 0, 0, 38, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 28, 29, - 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, - 0, 0, 0, 0, 0, 32, 0, 0, 0, 33, - 34, 0, 35, 0, 0, 0, 0, 0, 0, 496, - 0, 0, 0, 42, 0, 0, 0, 0, 0, 0, +const short QmlJSGrammar::action_info [] = { + -97, -98, 452, 611, -116, 527, 456, -124, 415, -121, + 439, 551, -119, -108, 347, -94, 611, 388, 635, 540, + 351, 341, 344, 342, 390, 539, -127, 256, 398, 402, + 100, 98, 70, -97, 400, 163, -98, 465, 524, -116, + 559, 447, 530, -108, 439, -127, 509, 439, 559, -94, + 537, 544, -121, 256, 443, -119, -124, 514, 439, 347, + 445, 526, 423, 452, 423, 430, 456, 423, 70, 554, + 169, 415, 345, 311, 100, 163, 419, 140, 146, 408, + 271, 413, 347, 251, 295, 271, 256, 0, 186, 452, + 0, 311, 456, 140, 429, 317, 0, 0, 0, 324, + 407, 178, 291, 98, 305, 558, 0, 235, 476, 0, + 439, 415, 300, 442, 291, 0, 189, 171, 140, 426, + 140, 148, 339, 182, 433, 140, 140, 443, 140, 303, + 326, 559, 140, 0, 140, 57, 172, 250, 188, 140, + 601, 140, 330, 293, 165, 0, 58, 313, 166, 140, + 332, 314, 631, 630, 255, 254, 477, 241, 240, 57, + 246, 245, 412, 411, 427, 57, 141, 529, 528, 63, + 58, 61, 336, 171, 248, 247, 58, 516, 253, 0, + 417, 468, 62, 327, 309, 334, 458, 57, 602, 248, + 247, 487, 172, 454, 522, 556, 555, 176, 58, 248, + 247, 625, 624, 84, 84, 85, 85, 140, 84, 84, + 85, 85, 63, 84, 64, 85, 86, 86, 510, 510, + 65, 86, 86, 84, 171, 85, 86, 63, 84, 0, + 85, 517, 515, 140, 469, 467, 86, 84, 140, 85, + 512, 86, 84, 172, 85, 405, 84, 102, 85, 140, + 86, 511, 628, 627, 140, 86, 84, 64, 85, 86, + 437, 436, 171, 65, 512, 512, 103, 510, 104, 86, + 546, 510, 64, 140, 510, 511, 511, 84, 65, 85, + 532, 172, 626, 405, 34, 0, 234, 233, 0, 0, + 86, 520, 519, 0, 0, 547, 545, 84, 0, 85, + 621, 0, 543, 542, 34, 0, 349, 0, 0, 0, + 86, 72, 73, 512, 622, 620, 34, 512, 0, 34, + 512, 47, 49, 48, 511, 0, 536, 535, 511, 171, + 0, 511, 34, 0, 533, 531, 72, 73, 74, 75, + 34, 47, 49, 48, 619, 34, 171, -85, 172, 34, + 173, 0, 34, 47, 49, 48, 47, 49, 48, 34, + 0, 0, 34, 74, 75, 172, 34, 173, 0, 47, + 49, 48, 34, 0, 171, 34, 0, 47, 49, 48, + 0, 0, 47, 49, 48, 0, 47, 49, 48, 47, + 49, 48, -85, 172, 0, 173, 47, 49, 48, 47, + 49, 48, 0, 47, 49, 48, 278, 279, 0, 47, + 49, 48, 47, 49, 48, 280, 278, 279, 281, 0, + 282, 0, 0, 34, 0, 280, 34, 0, 281, 34, + 282, 273, 274, -339, 278, 279, -339, 34, 0, 0, + 0, 0, 0, 280, 0, 0, 281, 0, 282, 34, + 0, 0, 0, 0, 0, 244, 243, 0, 275, 276, + 47, 49, 48, 47, 49, 48, 47, 49, 48, 244, + 243, 77, 78, 34, 47, 49, 48, 0, 0, 79, + 80, 239, 238, 81, 0, 82, 47, 49, 48, 77, + 78, 34, 0, 0, 0, 0, 0, 79, 80, 0, + 0, 81, 0, 82, 0, 239, 238, 77, 78, 34, + 47, 49, 48, 278, 279, 79, 80, 0, 0, 81, + 0, 82, 280, 244, 243, 281, 0, 282, 47, 49, + 48, 6, 5, 4, 1, 3, 2, 0, 0, 150, + 0, 239, 238, 0, 0, 0, 47, 49, 48, 151, + 0, 0, 0, 152, 0, 0, 0, 150, 0, 0, + 0, 0, 153, 0, 154, 0, 0, 151, 0, 0, + 0, 152, 0, 0, 0, 155, 0, 156, 61, 0, + 153, 0, 154, 0, 0, 157, 0, 0, 158, 62, + 77, 78, 0, 155, 159, 156, 61, 0, 79, 80, + 160, 0, 81, 157, 82, 0, 158, 62, 0, 0, + 0, 0, 159, 0, 0, 0, 161, 0, 160, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, + 31, 0, 0, 0, 161, 0, 0, 0, 0, 33, + 0, 0, 0, 0, 0, 0, 34, 0, 0, 0, + 35, 36, 0, 37, 0, 0, 0, 0, 0, 0, + 501, 0, 0, 0, 44, 0, 0, 150, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 151, 0, 0, + 0, 152, 50, 47, 49, 48, 0, 51, 0, 0, + 153, 0, 154, 0, 0, 307, 0, 0, 43, 53, + 32, 0, 0, 155, 40, 156, 61, 0, 0, 0, + 0, 0, 0, 157, 0, 0, 158, 62, 0, 0, + 0, 0, 159, 0, 0, 0, 0, 0, 160, 0, + 0, 0, 0, 0, 0, 0, 30, 31, 0, 0, + 0, 0, 0, 0, 161, 0, 33, 0, 0, 0, + 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, + 37, 0, 0, 0, 30, 31, 0, 41, 0, 0, + 0, 44, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 50, + 47, 49, 48, 0, 51, 501, 0, 0, 0, 44, + 0, 0, 0, 0, 0, 43, 53, 32, 0, 0, + 0, 40, 0, 0, 0, 0, 0, 50, 47, 49, + 48, 0, 51, 0, 500, 0, 30, 31, 0, 0, + 0, 0, 0, 43, 53, 32, 214, 0, 0, 40, + 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, + 37, 0, 30, 31, 0, 0, 0, 501, 0, 0, + 0, 44, 33, 0, 0, 0, 0, 0, 0, 34, + 0, 0, 0, 35, 36, 0, 37, 0, 0, 50, + 502, 504, 503, 41, 51, 0, 0, 44, 0, 225, + 0, 0, 0, 0, 0, 43, 53, 32, 209, 0, + 0, 40, 0, 0, 0, 50, 47, 49, 48, 0, + 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 43, 53, 32, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 48, 45, 47, 46, 0, 49, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 41, 51, 30, - 0, 0, 0, 38, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 495, 0, 28, 29, 0, 0, - 0, 0, 0, 0, 0, 0, 212, 0, 0, 0, - 0, 0, 0, 32, 0, 0, 0, 33, 34, 0, - 35, 0, 0, 0, 0, 0, 0, 496, 0, 0, - 0, 42, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, - 497, 499, 498, 0, 49, 0, 0, 0, 0, 223, - 0, 0, 0, 0, 0, 41, 51, 30, 207, 0, - 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 495, 0, 28, 29, 0, 0, 0, 0, - 0, 0, 0, 0, 212, 0, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 33, 34, 0, 35, 0, - 0, 0, 0, 0, 0, 496, 0, 0, 0, 42, - 0, 0, 0, 0, 0, 0, 0, 600, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 48, 497, 499, - 498, 0, 49, 0, 0, 0, 0, 223, 0, 0, - 0, 0, 0, 41, 51, 30, 207, 0, 0, 38, + 500, 0, 30, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 214, 0, 0, 0, 0, 0, 0, 34, + 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, + 0, 0, 0, 501, 0, 0, 0, 44, 0, 0, + 0, 0, 0, 0, 0, 608, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 502, 504, 503, 0, + 51, 0, 0, 0, 0, 225, 0, 0, 0, 0, + 0, 43, 53, 32, 209, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 495, 0, 28, 29, 0, 0, 0, 0, 0, 0, - 0, 0, 212, 0, 0, 0, 0, 0, 0, 32, - 0, 0, 0, 33, 34, 0, 35, 0, 0, 0, - 0, 0, 0, 496, 0, 0, 0, 42, 0, 0, - 0, 0, 0, 0, 0, 603, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 48, 497, 499, 498, 0, - 49, 0, 0, 0, 0, 223, 0, 0, 0, 0, - 0, 41, 51, 30, 207, 0, 0, 38, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 27, 28, - 29, 0, 0, 0, 0, 0, 0, 0, 0, 31, - 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, - 33, 34, 0, 35, 0, 0, 0, 36, 0, 37, - 39, 40, 0, 0, 42, 0, 0, 0, 43, 0, - 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 48, 45, 47, 46, 0, 49, 0, 50, - 0, 52, 0, 53, 0, 0, 0, 0, 41, 51, - 30, 0, 0, 0, 38, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 27, 28, 29, 0, 0, - 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, - 0, 0, 0, 32, 0, 0, 0, 33, 34, 0, - 35, 0, 0, 0, 36, 0, 37, 39, 40, 0, - 0, 42, 0, 0, 0, 43, 0, 44, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, - 45, 47, 46, 0, 49, 0, 50, 0, 52, 268, - 53, 0, 0, 0, 0, 41, 51, 30, 0, 0, - 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -115, 0, 0, 0, 27, 28, 29, 0, - 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, - 0, 0, 0, 0, 32, 0, 0, 0, 33, 34, - 0, 35, 0, 0, 0, 36, 0, 37, 39, 40, - 0, 0, 42, 0, 0, 0, 43, 0, 44, 0, + 500, 0, 30, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 214, 0, 0, 0, 0, 0, 0, 34, + 0, 0, 0, 35, 36, 0, 37, 0, 0, 0, + 0, 0, 0, 501, 0, 0, 0, 44, 0, 0, + 0, 0, 0, 0, 0, 605, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 50, 502, 504, 503, 0, + 51, 0, 0, 0, 0, 225, 0, 0, 0, 0, + 0, 43, 53, 32, 209, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 48, 45, 47, 46, 0, 49, 0, 50, 0, 52, - 0, 53, 0, 0, 0, 0, 41, 51, 30, 0, - 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 480, 0, 0, 27, 28, 29, 0, - 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, - 0, 0, 0, 0, 32, 0, 0, 0, 33, 34, - 0, 35, 0, 0, 0, 36, 0, 37, 39, 40, - 0, 0, 42, 0, 0, 0, 43, 0, 44, 0, - 0, 481, 0, 0, 0, 0, 0, 0, 0, 0, - 48, 45, 47, 46, 0, 49, 0, 50, 0, 52, - 0, 53, 0, 0, 0, 0, 41, 51, 30, 0, - 0, 0, 38, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 27, 28, 29, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, - 0, 32, 214, 0, 0, 561, 562, 0, 35, 0, - 0, 0, 36, 0, 37, 39, 40, 0, 0, 42, - 0, 0, 0, 43, 0, 44, 0, 0, 0, 0, - 0, 0, 0, 218, 0, 0, 0, 48, 45, 47, - 46, 0, 49, 0, 50, 0, 52, 0, 53, 0, - 0, 0, 0, 41, 51, 30, 0, 0, 0, 38, + 29, 30, 31, 0, 0, 0, 0, 0, 0, 0, + 0, 33, 0, 0, 0, 0, 0, 0, 34, 0, + 0, 0, 35, 36, 0, 37, 0, 0, 0, 38, + 0, 39, 41, 42, 0, 0, 44, 0, 0, 0, + 45, 0, 46, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 47, 49, 48, 0, 51, + 0, 52, 0, 54, 0, 55, 0, 0, 0, 0, + 43, 53, 32, 0, 0, 0, 40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -117, + 0, 0, 0, 29, 30, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, + 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, + 0, 0, 0, 45, 0, 46, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 50, 47, 49, + 48, 0, 51, 0, 52, 0, 54, 0, 55, 0, + 0, 0, 0, 43, 53, 32, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 480, 0, 0, 27, 28, 29, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 33, 34, 0, 35, 0, - 0, 0, 36, 0, 37, 39, 40, 0, 0, 42, - 0, 0, 0, 43, 0, 44, 0, 0, 483, 0, - 0, 0, 0, 0, 0, 0, 0, 48, 45, 47, - 46, 0, 49, 0, 50, 0, 52, 0, 53, 0, - 0, 0, 0, 41, 51, 30, 0, 0, 0, 38, + 0, 0, 29, 30, 31, 0, 0, 0, 0, 0, + 0, 0, 0, 33, 0, 0, 0, 0, 0, 0, + 34, 0, 0, 0, 35, 36, 0, 37, 0, 0, + 0, 38, 0, 39, 41, 42, 0, 0, 44, 0, + 0, 0, 45, 0, 46, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 50, 47, 49, 48, + 0, 51, 0, 52, 0, 54, 270, 55, 0, 0, + 0, 0, 43, 53, 32, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 472, 0, 0, 27, 28, 29, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 33, 34, 0, 35, 0, - 0, 0, 36, 0, 37, 39, 40, 0, 0, 42, - 0, 0, 0, 43, 0, 44, 0, 0, 473, 0, - 0, 0, 0, 0, 0, 0, 0, 48, 45, 47, - 46, 0, 49, 0, 50, 0, 52, 0, 53, 0, - 0, 0, 0, 41, 51, 30, 0, 0, 0, 38, + 0, 29, 30, 31, 0, 0, 0, 0, 0, 0, + 0, 0, 33, 0, 0, 0, 0, 0, 0, 34, + 216, 0, 0, 566, 567, 0, 37, 0, 0, 0, + 38, 0, 39, 41, 42, 0, 0, 44, 0, 0, + 0, 45, 0, 46, 0, 0, 0, 0, 0, 0, + 0, 220, 0, 0, 0, 50, 47, 49, 48, 0, + 51, 0, 52, 0, 54, 0, 55, 0, 0, 0, + 0, 43, 53, 32, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 472, 0, 0, 27, 28, 29, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 33, 34, 0, 35, 0, - 0, 0, 36, 0, 37, 39, 40, 0, 0, 42, - 0, 0, 0, 43, 0, 44, 0, 0, 478, 0, - 0, 0, 0, 0, 0, 0, 0, 48, 45, 47, - 46, 0, 49, 0, 50, 0, 52, 0, 53, 0, - 0, 0, 0, 41, 51, 30, 0, 0, 0, 38, + 474, 0, 0, 29, 30, 31, 0, 0, 0, 0, + 0, 0, 0, 0, 33, 0, 0, 0, 0, 0, + 0, 34, 0, 0, 0, 35, 36, 0, 37, 0, + 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, + 0, 0, 0, 45, 0, 46, 0, 0, 475, 0, + 0, 0, 0, 0, 0, 0, 0, 50, 47, 49, + 48, 0, 51, 0, 52, 0, 54, 0, 55, 0, + 0, 0, 0, 43, 53, 32, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 106, 107, 108, 0, 0, 110, 112, 113, 0, 0, - 114, 0, 115, 0, 0, 0, 117, 118, 119, 0, - 0, 0, 0, 0, 0, 32, 120, 121, 122, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 123, + 0, 0, 474, 0, 0, 29, 30, 31, 0, 0, + 0, 0, 0, 0, 0, 0, 33, 0, 0, 0, + 0, 0, 0, 34, 0, 0, 0, 35, 36, 0, + 37, 0, 0, 0, 38, 0, 39, 41, 42, 0, + 0, 44, 0, 0, 0, 45, 0, 46, 0, 0, + 480, 0, 0, 0, 0, 0, 0, 0, 0, 50, + 47, 49, 48, 0, 51, 0, 52, 0, 54, 0, + 55, 0, 0, 0, 0, 43, 53, 32, 0, 0, + 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 482, 0, 0, 29, 30, 31, + 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, + 0, 0, 0, 0, 0, 34, 0, 0, 0, 35, + 36, 0, 37, 0, 0, 0, 38, 0, 39, 41, + 42, 0, 0, 44, 0, 0, 0, 45, 0, 46, + 0, 0, 485, 0, 0, 0, 0, 0, 0, 0, + 0, 50, 47, 49, 48, 0, 51, 0, 52, 0, + 54, 0, 55, 0, 0, 0, 0, 43, 53, 32, + 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 482, 0, 0, 29, + 30, 31, 0, 0, 0, 0, 0, 0, 0, 0, + 33, 0, 0, 0, 0, 0, 0, 34, 0, 0, + 0, 35, 36, 0, 37, 0, 0, 0, 38, 0, + 39, 41, 42, 0, 0, 44, 0, 0, 0, 45, + 0, 46, 0, 0, 483, 0, 0, 0, 0, 0, + 0, 0, 0, 50, 47, 49, 48, 0, 51, 0, + 52, 0, 54, 0, 55, 0, 0, 0, 0, 43, + 53, 32, 0, 0, 0, 40, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 108, 109, + 110, 0, 0, 112, 114, 115, 0, 0, 116, 0, + 117, 0, 0, 0, 119, 120, 121, 0, 0, 0, + 0, 0, 0, 34, 122, 123, 124, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 126, 0, 0, 0, 0, - 0, 0, 45, 47, 46, 127, 128, 129, 0, 131, - 132, 133, 134, 135, 136, 0, 0, 124, 130, 116, - 109, 111, 125, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 106, 107, 108, 0, 0, 110, - 112, 113, 0, 0, 114, 0, 115, 0, 0, 0, - 117, 118, 119, 0, 0, 0, 0, 0, 0, 390, - 120, 121, 122, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 123, 0, 0, 0, 391, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, - 0, 0, 0, 0, 0, 395, 392, 394, 0, 127, - 128, 129, 0, 131, 132, 133, 134, 135, 136, 0, - 0, 124, 130, 116, 109, 111, 125, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 106, 107, - 108, 0, 0, 110, 112, 113, 0, 0, 114, 0, - 115, 0, 0, 0, 117, 118, 119, 0, 0, 0, - 0, 0, 0, 390, 120, 121, 122, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 123, 0, 0, - 0, 391, 0, 0, 0, 0, 0, 0, 0, 393, - 0, 0, 0, 126, 0, 0, 0, 0, 0, 395, - 392, 394, 0, 127, 128, 129, 0, 131, 132, 133, - 134, 135, 136, 0, 0, 124, 130, 116, 109, 111, - 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 206, 0, 0, 0, 0, 208, 0, 27, - 28, 29, 210, 0, 0, 0, 0, 0, 0, 211, - 31, 0, 0, 0, 0, 0, 0, 213, 214, 0, - 0, 215, 34, 0, 35, 0, 0, 0, 36, 0, - 37, 39, 40, 0, 0, 42, 0, 0, 0, 43, - 0, 44, 0, 0, 0, 0, 0, 217, 0, 218, - 0, 0, 0, 48, 216, 219, 46, 220, 49, 221, - 50, 222, 52, 223, 53, 224, 225, 0, 0, 41, - 51, 30, 207, 209, 0, 38, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 206, 0, 0, 0, - 0, 208, 0, 27, 28, 29, 210, 0, 0, 0, - 0, 0, 0, 211, 212, 0, 0, 0, 0, 0, - 0, 213, 214, 0, 0, 215, 34, 0, 35, 0, - 0, 0, 36, 0, 37, 39, 40, 0, 0, 42, - 0, 0, 0, 43, 0, 44, 0, 0, 0, 0, - 0, 217, 0, 218, 0, 0, 0, 48, 216, 219, - 46, 220, 49, 221, 50, 222, 52, 223, 53, 224, - 225, 0, 0, 41, 51, 30, 207, 209, 0, 38, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 564, 107, 108, 0, 0, 566, 112, 568, 28, 29, - 569, 0, 115, 0, 0, 0, 117, 571, 572, 0, - 0, 0, 0, 0, 0, 573, 574, 121, 122, 215, - 34, 0, 35, 0, 0, 0, 36, 0, 37, 575, - 40, 0, 0, 577, 0, 0, 0, 43, 0, 44, - 0, 0, 0, 0, 0, 579, 0, 218, 0, 0, - 0, 581, 578, 580, 46, 582, 583, 584, 50, 586, - 587, 588, 589, 590, 591, 0, 0, 576, 585, 570, - 565, 567, 125, 38, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 358, 107, 108, 0, 0, 360, - 112, 362, 28, 29, 363, 0, 115, 0, 0, 0, - 117, 365, 366, 0, 0, 0, 0, 0, 0, 367, - 368, 121, 122, 215, 34, 0, 35, 0, 0, 0, - 36, 0, 37, 369, 40, 0, 0, 371, 0, 0, - 0, 43, 0, 44, 0, -261, 0, 0, 0, 373, - 0, 218, 0, 0, 0, 375, 372, 374, 46, 376, - 377, 378, 50, 380, 381, 382, 383, 384, 385, 0, - 0, 370, 379, 364, 359, 361, 125, 38, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - 548, 422, 414, 436, 166, 547, 552, 433, 533, 529, - 183, 520, 536, 304, 545, 513, 306, 447, 247, 599, - 618, 147, 387, 317, 627, 613, 14, 492, 397, 204, - 624, 185, 179, 250, 389, 430, 168, 240, 299, 235, - 173, 179, 484, 407, 336, 433, 308, 348, 436, 346, - 433, 350, 247, 469, 464, 482, 331, 429, 333, 344, - 335, 179, 299, 247, 240, 432, 479, 140, 451, 240, - 442, 145, 446, 444, 457, 235, 160, 235, 453, 399, - 458, 455, 299, 137, 516, 143, 508, 426, 436, 204, - 0, 204, 412, 0, 0, 0, 0, 0, 458, 103, - 0, 143, 0, 0, 143, 0, 404, 0, 57, 175, - 299, 0, 57, 91, 177, 183, 57, 57, 449, 0, - 299, 105, 90, 57, 57, 57, 57, 0, 89, 88, - 57, 94, 95, 57, 57, 81, 65, 57, 263, 57, - 57, 486, 285, 267, 86, 57, 57, 64, 57, 165, - 87, 57, 57, 177, 57, 57, 57, 284, 57, 283, - 97, 282, 85, 401, 57, 99, 57, 57, 468, 92, - 57, 281, 449, 300, 57, 69, 491, 57, 57, 449, - 317, 57, 57, 327, 58, 67, 57, 341, 66, 401, - 234, 402, 162, 401, 299, 57, 57, 448, 57, 338, - 489, 57, 74, 488, 57, 57, 57, 487, 490, 477, - 93, 57, 57, 476, 177, 295, 267, 402, 295, 295, - 267, 402, 0, 267, 267, 295, 57, 494, 313, 494, - 267, 267, 628, 0, 57, 270, 595, 323, 103, 267, - 314, 294, 493, 503, 57, 292, 0, 316, 57, 267, - 295, 288, 326, 267, 57, 267, 0, 329, 299, 267, - 105, 172, 0, 310, 57, 0, 0, 290, 57, 267, - 601, 275, 297, 267, 57, 286, 0, 494, 604, 267, - 592, 287, 0, 594, 0, 494, 0, 595, 560, 0, - 0, 0, 493, 503, 0, 563, 556, 557, 558, 559, - 493, 503, 469, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 128, 0, 0, 0, 0, 0, 0, + 47, 49, 48, 129, 130, 131, 0, 133, 134, 135, + 136, 137, 138, 0, 0, 126, 132, 118, 111, 113, + 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 108, 109, 110, 0, 0, 112, + 114, 115, 0, 0, 116, 0, 117, 0, 0, 0, + 119, 120, 121, 0, 0, 0, 0, 0, 0, 392, + 122, 123, 124, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 125, 0, 0, 0, 393, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, + 0, 0, 0, 0, 0, 397, 394, 396, 0, 129, + 130, 131, 0, 133, 134, 135, 136, 137, 138, 0, + 0, 126, 132, 118, 111, 113, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 302, 0, 0, 0, 0, 0, 0, 0, 0, + 108, 109, 110, 0, 0, 112, 114, 115, 0, 0, + 116, 0, 117, 0, 0, 0, 119, 120, 121, 0, + 0, 0, 0, 0, 0, 392, 122, 123, 124, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 125, + 0, 0, 0, 393, 0, 0, 0, 0, 0, 0, + 0, 395, 0, 0, 0, 128, 0, 0, 0, 0, + 0, 397, 394, 396, 0, 129, 130, 131, 0, 133, + 134, 135, 136, 137, 138, 0, 0, 126, 132, 118, + 111, 113, 127, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 208, 0, 0, 0, + 0, 210, 0, 29, 30, 31, 212, 0, 0, 0, + 0, 0, 0, 213, 33, 0, 0, 0, 0, 0, + 0, 215, 216, 0, 0, 217, 36, 0, 37, 0, + 0, 0, 38, 0, 39, 41, 42, 0, 0, 44, + 0, 0, 0, 45, 0, 46, 0, 0, 0, 0, + 0, 219, 0, 220, 0, 0, 0, 50, 218, 221, + 48, 222, 51, 223, 52, 224, 54, 225, 55, 226, + 227, 0, 0, 43, 53, 32, 209, 211, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 208, 0, 0, 0, 0, 210, 0, 29, + 30, 31, 212, 0, 0, 0, 0, 0, 0, 213, + 214, 0, 0, 0, 0, 0, 0, 215, 216, 0, + 0, 217, 36, 0, 37, 0, 0, 0, 38, 0, + 39, 41, 42, 0, 0, 44, 0, 0, 0, 45, + 0, 46, 0, 0, 0, 0, 0, 219, 0, 220, + 0, 0, 0, 50, 218, 221, 48, 222, 51, 223, + 52, 224, 54, 225, 55, 226, 227, 0, 0, 43, + 53, 32, 209, 211, 0, 40, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 569, 109, + 110, 0, 0, 571, 114, 573, 30, 31, 574, 0, + 117, 0, 0, 0, 119, 576, 577, 0, 0, 0, + 0, 0, 0, 578, 579, 123, 124, 217, 36, 0, + 37, 0, 0, 0, 38, 0, 39, 580, 42, 0, + 0, 582, 0, 0, 0, 45, 0, 46, 0, 0, + 0, 0, 0, 584, 0, 220, 0, 0, 0, 586, + 583, 585, 48, 587, 588, 589, 52, 591, 592, 593, + 594, 595, 596, 0, 0, 581, 590, 575, 570, 572, + 127, 40, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 360, 109, 110, 0, 0, 362, + 114, 364, 30, 31, 365, 0, 117, 0, 0, 0, + 119, 367, 368, 0, 0, 0, 0, 0, 0, 369, + 370, 123, 124, 217, 36, 0, 37, 0, 0, 0, + 38, 0, 39, 371, 42, 0, 0, 373, 0, 0, + 0, 45, 0, 46, 0, -263, 0, 0, 0, 375, + 0, 220, 0, 0, 0, 377, 374, 376, 48, 378, + 379, 380, 52, 382, 383, 384, 385, 386, 387, 0, + 0, 372, 381, 366, 361, 363, 127, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 541, 310, 460, 513, 538, 518, 525, 308, 249, 632, + 306, 181, 252, 618, 149, 16, 623, 495, 319, 497, + 629, 357, 496, 435, 471, 553, 557, 486, 438, 301, + 428, 237, 350, 352, 604, 521, 242, 424, 550, 552, + 181, 301, 185, 237, 242, 343, 432, 348, 338, 249, + 459, 237, 453, 449, 236, 242, 446, 181, 466, 401, + 448, 249, 357, 455, 444, 457, 346, 337, 357, 484, + 142, 236, 147, 333, 438, 175, 301, 335, 187, 409, + 162, 145, 435, 416, 435, 139, 170, 399, 414, 481, + 438, 389, 0, 168, 0, 0, 403, 357, 403, 59, + 357, 490, 301, 534, 391, 0, 0, 0, 301, 0, + 0, 460, 0, 145, 59, 0, 179, 403, 177, 59, + 59, 488, 489, 0, 404, 105, 404, 0, 59, 185, + 451, 59, 59, 450, 59, 59, 59, 59, 59, 283, + 284, 59, 287, 285, 145, 404, 286, 107, 167, 406, + 164, 59, 59, 451, 450, 265, 59, 59, 301, 59, + 269, 68, 96, 95, 479, 59, 59, 331, 478, 59, + 87, 76, 59, 329, 59, 97, 434, 83, 89, 431, + 59, 470, 59, 59, 59, 94, 88, 59, 93, 92, + 59, 59, 90, 59, 59, 91, 493, 59, 59, 71, + 67, 59, 59, 491, 492, 99, 59, 101, 179, 319, + 301, 59, 59, 340, 69, 60, 59, 59, 450, 66, + 59, 59, 451, 304, 105, 499, 269, 297, 297, 297, + 59, 59, 269, 269, 269, 269, 269, 0, 315, 272, + 498, 508, 294, 0, 0, 0, 107, 174, 59, 325, + 318, 316, 297, 269, 59, 290, 0, 269, 297, 269, + 0, 59, 0, 269, 59, 0, 269, 292, 59, 269, + 179, 277, 59, 0, 299, 302, 312, 269, 59, 288, + 296, 328, 609, 269, 499, 289, 597, 633, 606, 599, + 499, 600, 565, 600, 0, 0, 499, 0, 0, 568, + 561, 562, 563, 564, 0, 498, 508, 0, 471, 0, + 0, 498, 508, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 494, 0, 0, 598, 0, 0, 0, 595, 0, 0, + 499, 0, 0, 603, 0, 0, 0, 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -645,124 +636,102 @@ const int QmlJSGrammar::action_info [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0}; + 0, 0, 0}; -const int QmlJSGrammar::action_check [] = { - 36, 7, 7, 7, 7, 36, 7, 36, 7, 36, - 60, 33, 33, 36, 7, 7, 7, 36, 36, 7, - 77, 36, 36, 60, 33, 55, 16, 55, 79, 90, - 7, 55, 8, 7, 36, 7, 36, 48, 20, 8, - 79, 36, 7, 2, 8, 90, 33, 36, 33, 17, - 48, 0, 33, 1, 33, 8, 36, 7, 36, 55, - 2, 8, 7, 60, 7, 5, 60, 5, 5, 36, - 33, 7, 29, 17, 60, 36, 60, 60, 48, 7, - 55, 36, 2, 2, 7, 7, 7, 33, 1, 7, - 61, 8, 8, 7, 29, 36, 7, 24, 37, 61, - 66, 33, 1, 61, 60, 1, 79, 7, 60, 10, - 8, 40, 66, 8, 29, 48, 8, 29, 6, -1, - 29, 31, 51, 7, 8, 50, 15, 61, 62, 54, - 61, 62, 20, 8, 8, 61, 62, 61, 62, 42, - 8, 8, 50, 7, 15, 34, 54, 8, 8, 8, - 53, 8, -1, 7, 55, 61, 62, 8, 56, 61, - 62, 40, 40, 34, 56, 60, 8, 61, 62, 33, - 61, 62, 51, 51, 61, 62, 61, 62, 61, 62, - 8, 25, 8, 27, 40, 60, 29, 61, 8, 25, - -1, 27, 60, 60, 38, 51, 25, 15, 27, 60, - 60, 60, 38, 60, 25, 56, 27, 29, 15, 38, - 29, 7, 12, 29, 29, 8, 34, 38, 36, 61, - 62, 7, -1, 36, 8, -1, 15, 34, -1, 36, - -1, -1, 75, 61, 62, 61, 62, 25, 12, 27, - 12, 61, 62, 86, 8, 34, -1, 36, 61, 62, - 38, 61, 62, 75, 29, -1, 75, 57, 29, 75, - 75, 15, -1, 63, 86, 61, 62, 86, 61, 62, - 86, 86, -1, -1, -1, 61, 62, 61, 62, 29, - 34, 91, 36, 57, 29, 57, 15, 47, 29, 63, - -1, 63, 56, -1, 15, 66, 67, 68, -1, -1, - 75, 61, 62, 29, 33, 34, -1, 36, -1, -1, - -1, 86, 33, 34, 29, 36, 66, 67, 68, 29, - -1, 66, 67, 68, 29, 66, 67, 68, 29, -1, - -1, 91, 18, 19, 25, 29, 27, -1, -1, -1, - 66, 67, 68, 92, 93, 94, 95, 38, 18, 19, - 29, 66, 67, 68, 29, -1, 66, 67, 68, 45, - 46, 66, 67, 68, 29, 66, 67, 68, -1, 23, - 24, -1, 66, 67, 68, 45, 46, 29, 32, -1, - -1, 35, -1, 37, -1, -1, -1, 66, 67, 68, - 29, 66, 67, 68, -1, -1, -1, 36, -1, 29, - -1, 66, 67, 68, -1, -1, 36, 18, 19, 23, - 24, -1, -1, -1, 66, 67, 68, -1, 32, -1, - -1, 35, -1, 37, -1, -1, -1, 66, 67, 68, - -1, 23, 24, -1, 45, 46, 66, 67, 68, 31, - 32, 23, 24, 35, -1, 37, -1, -1, -1, 31, - 32, 23, 24, 35, -1, 37, -1, -1, -1, 31, - 32, 23, 24, 35, -1, 37, -1, -1, -1, 31, - 32, 23, 24, 35, 29, 37, -1, -1, -1, 31, - 32, -1, 29, 35, -1, 37, -1, 23, 24, -1, - 29, -1, -1, -1, -1, -1, 32, -1, 29, 35, - -1, 37, -1, -1, -1, -1, 61, 62, -1, -1, - -1, 66, 67, 68, 61, 62, -1, -1, -1, 66, - 67, 68, 61, 62, -1, -1, -1, 66, 67, 68, - 61, 62, 3, -1, -1, 66, 67, 68, -1, -1, - -1, -1, 13, -1, -1, -1, 17, -1, -1, -1, - -1, -1, -1, -1, -1, 26, -1, 28, -1, -1, - -1, -1, 29, -1, -1, -1, -1, -1, 39, -1, - 41, 42, -1, -1, -1, -1, -1, -1, 49, -1, - -1, 52, 53, -1, -1, -1, -1, 58, 3, -1, - -1, -1, -1, 64, 61, 62, -1, -1, 13, 66, - 67, 68, 17, -1, -1, -1, -1, -1, -1, 80, - -1, 26, -1, 28, -1, -1, 31, -1, -1, -1, - -1, -1, -1, -1, 39, -1, 41, 42, -1, 12, - 13, 3, -1, -1, 49, -1, -1, 52, 53, 22, - -1, 13, -1, 58, -1, 17, 29, -1, -1, 64, - 33, 34, -1, 36, 26, -1, 28, -1, -1, -1, - 43, -1, -1, -1, 47, 80, -1, 39, -1, 41, - 42, -1, -1, -1, -1, -1, -1, 49, -1, -1, - 52, 53, 65, 66, 67, 68, 58, 70, -1, -1, - -1, -1, 64, -1, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, 87, -1, -1, -1, 80, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, - -1, -1, -1, -1, -1, -1, 12, 13, 22, -1, - -1, -1, -1, -1, -1, 29, 22, -1, -1, 33, - 34, -1, 36, 29, -1, -1, -1, 33, 34, 43, - 36, -1, -1, 47, -1, -1, -1, 43, -1, -1, - -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, -1, 65, - 66, 67, 68, -1, 70, -1, -1, 81, 82, 83, - -1, -1, -1, 87, -1, 81, 82, 83, -1, -1, - -1, 87, -1, -1, 12, 13, -1, -1, -1, -1, - -1, -1, 12, 13, 22, -1, -1, -1, -1, -1, - -1, 29, 22, -1, -1, 33, 34, -1, 36, 29, - -1, -1, -1, 33, 34, 43, 36, -1, -1, 47, - -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, -1, 65, 66, 67, 68, -1, - 70, -1, -1, 81, 82, 83, -1, -1, -1, 87, - -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, - -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, - -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, - 34, -1, 36, -1, -1, -1, -1, -1, -1, 43, - -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 65, 66, 67, 68, -1, 70, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 81, 82, 83, - -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 10, -1, 12, 13, -1, -1, - -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, +const short QmlJSGrammar::action_check [] = { + 7, 7, 36, 90, 7, 29, 36, 7, 36, 7, + 33, 8, 7, 7, 36, 7, 90, 7, 0, 7, + 16, 60, 55, 33, 8, 29, 7, 36, 7, 55, + 79, 48, 1, 7, 55, 2, 7, 17, 37, 7, + 33, 60, 29, 7, 33, 7, 66, 33, 33, 7, + 66, 29, 7, 36, 20, 7, 7, 29, 33, 36, + 36, 24, 5, 36, 5, 7, 36, 5, 1, 60, + 7, 36, 7, 2, 79, 2, 33, 8, 8, 7, + 1, 7, 36, 36, 8, 1, 36, -1, 8, 36, + -1, 2, 36, 8, 55, 7, -1, -1, -1, 17, + 60, 60, 48, 48, 60, 7, -1, 55, 8, -1, + 33, 36, 61, 6, 48, -1, 33, 15, 8, 10, + 8, 60, 36, 36, 7, 8, 8, 20, 8, 61, + 8, 33, 8, -1, 8, 40, 34, 77, 60, 8, + 8, 8, 61, 79, 50, -1, 51, 50, 54, 8, + 60, 54, 61, 62, 61, 62, 56, 61, 62, 40, + 61, 62, 61, 62, 55, 40, 56, 61, 62, 12, + 51, 42, 60, 15, 61, 62, 51, 7, 60, -1, + 60, 8, 53, 61, 60, 31, 60, 40, 56, 61, + 62, 60, 34, 60, 29, 61, 62, 56, 51, 61, + 62, 61, 62, 25, 25, 27, 27, 8, 25, 25, + 27, 27, 12, 25, 57, 27, 38, 38, 29, 29, + 63, 38, 38, 25, 15, 27, 38, 12, 25, -1, + 27, 61, 62, 8, 61, 62, 38, 25, 8, 27, + 75, 38, 25, 34, 27, 36, 25, 15, 27, 8, + 38, 86, 61, 62, 8, 38, 25, 57, 27, 38, + 61, 62, 15, 63, 75, 75, 34, 29, 36, 38, + 36, 29, 57, 8, 29, 86, 86, 25, 63, 27, + 7, 34, 91, 36, 29, -1, 61, 62, -1, -1, + 38, 61, 62, -1, -1, 61, 62, 25, -1, 27, + 47, -1, 61, 62, 29, -1, 60, -1, -1, -1, + 38, 18, 19, 75, 61, 62, 29, 75, -1, 29, + 75, 66, 67, 68, 86, -1, 61, 62, 86, 15, + -1, 86, 29, -1, 61, 62, 18, 19, 45, 46, + 29, 66, 67, 68, 91, 29, 15, 33, 34, 29, + 36, -1, 29, 66, 67, 68, 66, 67, 68, 29, + -1, -1, 29, 45, 46, 34, 29, 36, -1, 66, + 67, 68, 29, -1, 15, 29, -1, 66, 67, 68, + -1, -1, 66, 67, 68, -1, 66, 67, 68, 66, + 67, 68, 33, 34, -1, 36, 66, 67, 68, 66, + 67, 68, -1, 66, 67, 68, 23, 24, -1, 66, + 67, 68, 66, 67, 68, 32, 23, 24, 35, -1, + 37, -1, -1, 29, -1, 32, 29, -1, 35, 29, + 37, 18, 19, 36, 23, 24, 36, 29, -1, -1, + -1, -1, -1, 32, -1, -1, 35, -1, 37, 29, + -1, -1, -1, -1, -1, 61, 62, -1, 45, 46, + 66, 67, 68, 66, 67, 68, 66, 67, 68, 61, + 62, 23, 24, 29, 66, 67, 68, -1, -1, 31, + 32, 61, 62, 35, -1, 37, 66, 67, 68, 23, + 24, 29, -1, -1, -1, -1, -1, 31, 32, -1, + -1, 35, -1, 37, -1, 61, 62, 23, 24, 29, + 66, 67, 68, 23, 24, 31, 32, -1, -1, 35, + -1, 37, 32, 61, 62, 35, -1, 37, 66, 67, + 68, 92, 93, 94, 95, 96, 97, -1, -1, 3, + -1, 61, 62, -1, -1, -1, 66, 67, 68, 13, + -1, -1, -1, 17, -1, -1, -1, 3, -1, -1, + -1, -1, 26, -1, 28, -1, -1, 13, -1, -1, + -1, 17, -1, -1, -1, 39, -1, 41, 42, -1, + 26, -1, 28, -1, -1, 49, -1, -1, 52, 53, + 23, 24, -1, 39, 58, 41, 42, -1, 31, 32, + 64, -1, 35, 49, 37, -1, 52, 53, -1, -1, + -1, -1, 58, -1, -1, -1, 80, -1, 64, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, + 13, -1, -1, -1, 80, -1, -1, -1, -1, 22, + -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, + 33, 34, -1, 36, -1, -1, -1, -1, -1, -1, + 43, -1, -1, -1, 47, -1, -1, 3, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 13, -1, -1, + -1, 17, 65, 66, 67, 68, -1, 70, -1, -1, + 26, -1, 28, -1, -1, 31, -1, -1, 81, 82, + 83, -1, -1, 39, 87, 41, 42, -1, -1, -1, + -1, -1, -1, 49, -1, -1, 52, 53, -1, -1, + -1, -1, 58, -1, -1, -1, -1, -1, 64, -1, + -1, -1, -1, -1, -1, -1, 12, 13, -1, -1, + -1, -1, -1, -1, 80, -1, 22, -1, -1, -1, + -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, + 36, -1, -1, -1, 12, 13, -1, 43, -1, -1, + -1, 47, -1, -1, 22, -1, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 33, 34, -1, 36, 65, + 66, 67, 68, -1, 70, 43, -1, -1, -1, 47, + -1, -1, -1, -1, -1, 81, 82, 83, -1, -1, + -1, 87, -1, -1, -1, -1, -1, 65, 66, 67, + 68, -1, 70, -1, 10, -1, 12, 13, -1, -1, + -1, -1, -1, 81, 82, 83, 22, -1, -1, 87, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, - 36, -1, -1, -1, -1, -1, -1, 43, -1, -1, - -1, 47, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, - 66, 67, 68, -1, 70, -1, -1, -1, -1, 75, + 36, -1, 12, 13, -1, -1, -1, 43, -1, -1, + -1, 47, 22, -1, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34, -1, 36, -1, -1, 65, + 66, 67, 68, 43, 70, -1, -1, 47, -1, 75, -1, -1, -1, -1, -1, 81, 82, 83, 84, -1, - -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 10, -1, 12, 13, -1, -1, -1, -1, - -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, - -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, - -1, -1, -1, -1, -1, 43, -1, -1, -1, 47, - -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, -1, -1, -1, 75, -1, -1, - -1, -1, -1, 81, 82, 83, 84, -1, -1, 87, + -1, 87, -1, -1, -1, 65, 66, 67, 68, -1, + 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, @@ -772,68 +741,51 @@ const int QmlJSGrammar::action_check [] = { -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 11, 12, - 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, - -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, - 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, - 43, 44, -1, -1, 47, -1, -1, -1, 51, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, - -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, - 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 11, 12, 13, -1, -1, - -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, - -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, - 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, - -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, - 66, 67, 68, -1, 70, -1, 72, -1, 74, 75, - 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, - -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 7, -1, -1, -1, 11, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, - -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, - -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, - -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, - -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, - -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, - -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, - -1, -1, 47, -1, -1, -1, 51, -1, 53, -1, - -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, - 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, - -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, - -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, - -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, - -1, 29, 30, -1, -1, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, - -1, -1, -1, 61, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, - -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, + 10, -1, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, + -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, + -1, -1, -1, 43, -1, -1, -1, 47, -1, -1, + -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, + 70, -1, -1, -1, -1, 75, -1, -1, -1, -1, + -1, 81, 82, 83, 84, -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, + 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, + -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, + -1, 42, 43, 44, -1, -1, 47, -1, -1, -1, + 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, + -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, + 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, + -1, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, + -1, -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, - -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, - -1, 29, -1, -1, -1, 33, 34, -1, 36, -1, - -1, -1, 40, -1, 42, 43, 44, -1, -1, 47, - -1, -1, -1, 51, -1, 53, -1, -1, 56, -1, - -1, -1, -1, -1, -1, -1, -1, 65, 66, 67, - 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, - -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, + -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, + -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, + 29, -1, -1, -1, 33, 34, -1, 36, -1, -1, + -1, 40, -1, 42, 43, 44, -1, -1, 47, -1, + -1, -1, 51, -1, 53, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 65, 66, 67, 68, + -1, 70, -1, 72, -1, 74, 75, 76, -1, -1, + -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, + -1, -1, 22, -1, -1, -1, -1, -1, -1, 29, + 30, -1, -1, 33, 34, -1, 36, -1, -1, -1, + 40, -1, 42, 43, 44, -1, -1, 47, -1, -1, + -1, 51, -1, 53, -1, -1, -1, -1, -1, -1, + -1, 61, -1, -1, -1, 65, 66, 67, 68, -1, + 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, + -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, @@ -844,15 +796,43 @@ const int QmlJSGrammar::action_check [] = { 68, -1, 70, -1, 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, - 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, - -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, + -1, -1, 8, -1, -1, 11, 12, 13, -1, -1, + -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, + -1, -1, -1, 29, -1, -1, -1, 33, 34, -1, + 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, + 56, -1, -1, -1, -1, -1, -1, -1, -1, 65, + 66, 67, 68, -1, 70, -1, 72, -1, 74, -1, + 76, -1, -1, -1, -1, 81, 82, 83, -1, -1, + -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 8, -1, -1, 11, 12, 13, + -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, + -1, -1, -1, -1, -1, 29, -1, -1, -1, 33, + 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, + 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, + -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, + -1, 65, 66, 67, 68, -1, 70, -1, 72, -1, + 74, -1, 76, -1, -1, -1, -1, 81, 82, 83, + -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, + 12, 13, -1, -1, -1, -1, -1, -1, -1, -1, + 22, -1, -1, -1, -1, -1, -1, 29, -1, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, 56, -1, -1, -1, -1, -1, + -1, -1, -1, 65, 66, 67, 68, -1, 70, -1, + 72, -1, 74, -1, 76, -1, -1, -1, -1, 81, + 82, 83, -1, -1, -1, 87, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, + 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, + 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, + -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, - -1, -1, 66, 67, 68, 69, 70, 71, -1, 73, - 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, - 84, 85, 86, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, + 66, 67, 68, 69, 70, 71, -1, 73, 74, 75, + 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, + 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, @@ -862,25 +842,16 @@ const int QmlJSGrammar::action_check [] = { -1, -1, -1, -1, -1, 65, 66, 67, -1, 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, - 6, -1, -1, 9, 10, 11, -1, -1, 14, -1, - 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, - -1, -1, -1, 29, 30, 31, 32, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, - -1, 47, -1, -1, -1, -1, -1, -1, -1, 55, - -1, -1, -1, 59, -1, -1, -1, -1, -1, 65, - 66, 67, -1, 69, 70, 71, -1, 73, 74, 75, - 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, - 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, - 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, - 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, - -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, - 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, - -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, - -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, - 82, 83, 84, 85, -1, 87, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 4, 5, 6, -1, -1, 9, 10, 11, -1, -1, + 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, + -1, -1, -1, -1, -1, 29, 30, 31, 32, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, + -1, -1, -1, 47, -1, -1, -1, -1, -1, -1, + -1, 55, -1, -1, -1, 59, -1, -1, -1, -1, + -1, 65, 66, 67, -1, 69, 70, 71, -1, 73, + 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, + 84, 85, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, 22, -1, -1, -1, -1, -1, @@ -891,15 +862,25 @@ const int QmlJSGrammar::action_check [] = { 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, - 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, - -1, -1, -1, -1, -1, 29, 30, 31, 32, 33, - 34, -1, 36, -1, -1, -1, 40, -1, 42, 43, - 44, -1, -1, 47, -1, -1, -1, 51, -1, 53, - -1, -1, -1, -1, -1, 59, -1, 61, -1, -1, - -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, - 84, 85, 86, 87, -1, -1, -1, -1, -1, -1, + -1, -1, 4, -1, -1, -1, -1, 9, -1, 11, + 12, 13, 14, -1, -1, -1, -1, -1, -1, 21, + 22, -1, -1, -1, -1, -1, -1, 29, 30, -1, + -1, 33, 34, -1, 36, -1, -1, -1, 40, -1, + 42, 43, 44, -1, -1, 47, -1, -1, -1, 51, + -1, 53, -1, -1, -1, -1, -1, 59, -1, 61, + -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, + 82, 83, 84, 85, -1, 87, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, + 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, + 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, + -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, + 36, -1, -1, -1, 40, -1, 42, 43, 44, -1, + -1, 47, -1, -1, -1, 51, -1, 53, -1, -1, + -1, -1, -1, 59, -1, 61, -1, -1, -1, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, + 86, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, 14, -1, 16, -1, -1, -1, 20, 21, 22, -1, -1, -1, -1, -1, -1, 29, @@ -909,45 +890,42 @@ const int QmlJSGrammar::action_check [] = { -1, 61, -1, -1, -1, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, -1, -1, 81, 82, 83, 84, 85, 86, 87, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, - - 13, 94, 3, 19, 33, 23, 13, 3, 23, 3, - 13, 23, 3, 2, 23, 3, 3, 19, 2, 17, - 13, 65, 33, 13, 9, 11, 3, 2, 33, 2, - 13, 13, 13, 3, 34, 3, 33, 13, 3, 13, - 3, 13, 3, 2, 13, 3, 2, 2, 19, 3, - 3, 2, 2, 33, 33, 33, 2, 79, 3, 2, - 2, 13, 3, 2, 13, 79, 33, 33, 3, 13, - 96, 33, 19, 13, 2, 13, 33, 13, 2, 2, - 13, 3, 3, 3, 11, 33, 23, 91, 19, 2, - -1, 2, 2, -1, -1, -1, -1, -1, 13, 13, - -1, 33, -1, -1, 33, -1, 38, -1, 42, 38, - 3, -1, 42, 47, 44, 13, 42, 42, 44, -1, - 3, 35, 47, 42, 42, 42, 42, -1, 47, 47, - 42, 48, 48, 42, 42, 47, 44, 42, 42, 42, - 42, 44, 47, 47, 46, 42, 42, 44, 42, 58, - 46, 42, 42, 44, 42, 42, 42, 47, 42, 47, - 54, 47, 46, 11, 42, 52, 42, 42, 83, 47, - 42, 47, 44, 66, 42, 50, 44, 42, 42, 44, - 13, 42, 42, 66, 45, 45, 42, 98, 44, 11, - 103, 39, 56, 11, 3, 42, 42, 44, 42, 97, - 44, 42, 48, 44, 42, 42, 42, 44, 44, 29, - 48, 42, 42, 33, 44, 42, 47, 39, 42, 42, - 47, 39, -1, 47, 47, 42, 42, 11, 59, 11, - 47, 47, 14, -1, 42, 51, 18, 64, 13, 47, - 64, 64, 26, 27, 42, 53, -1, 64, 42, 47, - 42, 49, 85, 47, 42, 47, -1, 66, 3, 47, - 35, 36, -1, 57, 42, -1, -1, 55, 42, 47, - 4, 49, 64, 47, 42, 49, -1, 11, 4, 47, - 11, 49, -1, 14, -1, 11, -1, 18, 11, -1, - -1, -1, 26, 27, -1, 18, 19, 20, 21, 22, - 26, 27, 33, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + + 3, 2, 15, 25, 25, 3, 25, 3, 2, 11, + 2, 15, 3, 13, 67, 3, 15, 104, 15, 2, + 15, 2, 4, 3, 35, 15, 15, 3, 21, 3, + 93, 15, 2, 2, 19, 13, 15, 96, 25, 25, + 15, 3, 15, 15, 15, 100, 3, 3, 15, 2, + 2, 15, 3, 21, 4, 15, 15, 15, 35, 2, + 21, 2, 2, 2, 98, 3, 2, 2, 2, 35, + 35, 4, 35, 2, 21, 3, 3, 3, 15, 2, + 35, 35, 3, 3, 3, 3, 35, 35, 2, 35, + 21, 35, -1, 35, -1, -1, 13, 2, 13, 44, + 2, 46, 3, 3, 36, -1, -1, -1, 3, -1, + -1, 15, -1, 35, 44, -1, 46, 13, 40, 44, + 44, 46, 46, -1, 41, 15, 41, -1, 44, 15, + 46, 44, 44, 46, 44, 44, 44, 44, 44, 49, + 49, 44, 49, 49, 35, 41, 49, 37, 60, 40, + 58, 44, 44, 46, 46, 44, 44, 44, 3, 44, + 49, 46, 50, 50, 31, 44, 44, 68, 35, 44, + 48, 50, 44, 68, 44, 50, 81, 49, 48, 81, + 44, 85, 44, 44, 44, 49, 48, 44, 49, 49, + 44, 44, 49, 44, 44, 49, 46, 44, 44, 52, + 46, 44, 44, 46, 46, 56, 44, 54, 46, 15, + 3, 44, 44, 99, 47, 47, 44, 44, 46, 46, + 44, 44, 46, 68, 15, 13, 49, 44, 44, 44, + 44, 44, 49, 49, 49, 49, 49, -1, 61, 53, + 28, 29, 55, -1, -1, -1, 37, 38, 44, 66, + 66, 66, 44, 49, 44, 51, -1, 49, 44, 49, + -1, 44, -1, 49, 44, -1, 49, 57, 44, 49, + 46, 51, 44, -1, 66, 68, 59, 49, 44, 51, + 66, 87, 5, 49, 13, 51, 13, 16, 5, 16, + 13, 20, 13, 20, -1, -1, 13, -1, -1, 20, + 21, 22, 23, 24, -1, 28, 29, -1, 35, -1, + -1, 28, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 11, -1, -1, 14, -1, -1, -1, 18, -1, -1, + 13, -1, -1, 16, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -956,5 +934,6 @@ const int QmlJSGrammar::action_check [] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1}; + -1, -1, -1}; +QT_END_NAMESPACE diff --git a/src/declarative/qml/parser/qmljsgrammar_p.h b/src/declarative/qml/parser/qmljsgrammar_p.h index d607e8d..903e2c4 100644 --- a/src/declarative/qml/parser/qmljsgrammar_p.h +++ b/src/declarative/qml/parser/qmljsgrammar_p.h @@ -1,4 +1,3 @@ -// This file was generated by qlalr - DO NOT EDIT! /**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). @@ -51,16 +50,21 @@ // We mean it. // +// This file was generated by qlalr - DO NOT EDIT! #ifndef QMLJSGRAMMAR_P_H #define QMLJSGRAMMAR_P_H +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + class QmlJSGrammar { public: enum { EOF_SYMBOL = 0, - REDUCE_HERE = 97, - SHIFT_THERE = 96, + REDUCE_HERE = 99, + SHIFT_THERE = 98, T_AND = 1, T_AND_AND = 2, T_AND_EQ = 3, @@ -87,6 +91,8 @@ public: T_EQ_EQ_EQ = 19, T_FALSE = 83, T_FEED_JS_EXPRESSION = 95, + T_FEED_JS_PROGRAM = 97, + T_FEED_JS_SOURCE_ELEMENT = 96, T_FEED_JS_STATEMENT = 94, T_FEED_UI_OBJECT_MEMBER = 93, T_FEED_UI_PROGRAM = 92, @@ -157,38 +163,33 @@ public: T_XOR = 79, T_XOR_EQ = 80, - ACCEPT_STATE = 630, - RULE_COUNT = 340, - STATE_COUNT = 631, - TERMINAL_COUNT = 98, - NON_TERMINAL_COUNT = 105, + ACCEPT_STATE = 635, + RULE_COUNT = 343, + STATE_COUNT = 636, + TERMINAL_COUNT = 100, + NON_TERMINAL_COUNT = 106, - GOTO_INDEX_OFFSET = 631, - GOTO_INFO_OFFSET = 2618, - GOTO_CHECK_OFFSET = 2618 + GOTO_INDEX_OFFSET = 636, + GOTO_INFO_OFFSET = 2520, + GOTO_CHECK_OFFSET = 2520 }; - static const char *const spell []; - static const int lhs []; - static const int rhs []; - static const int goto_default []; - static const int action_default []; - static const int action_index []; - static const int action_info []; - static const int action_check []; + static const char *const spell []; + static const short lhs []; + static const short rhs []; + static const short goto_default []; + static const short action_default []; + static const short action_index []; + static const short action_info []; + static const short action_check []; static inline int nt_action (int state, int nt) { - const int *const goto_index = &action_index [GOTO_INDEX_OFFSET]; - const int *const goto_check = &action_check [GOTO_CHECK_OFFSET]; - - const int yyn = goto_index [state] + nt; - - if (yyn < 0 || goto_check [yyn] != nt) + const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt; + if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt) return goto_default [nt]; - const int *const goto_info = &action_info [GOTO_INFO_OFFSET]; - return goto_info [yyn]; + return action_info [GOTO_INFO_OFFSET + yyn]; } static inline int t_action (int state, int token) @@ -203,5 +204,6 @@ public: }; +QT_END_NAMESPACE #endif // QMLJSGRAMMAR_P_H diff --git a/src/declarative/qml/parser/qmljsparser.cpp b/src/declarative/qml/parser/qmljsparser.cpp index 8ca3c30..856d06d 100644 --- a/src/declarative/qml/parser/qmljsparser.cpp +++ b/src/declarative/qml/parser/qmljsparser.cpp @@ -1,8 +1,6 @@ -// This file was generated by qlalr - DO NOT EDIT! - /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -41,18 +39,20 @@ ** ****************************************************************************/ -#include "qmljsparser_p.h" +#include <QtCore/QtDebug> +#include <QtGui/QApplication> + +#include <string.h> #include "qmljsengine_p.h" #include "qmljslexer_p.h" #include "qmljsast_p.h" #include "qmljsnodepool_p.h" -#include <QtCore/QtDebug> -#include <QtCore/QCoreApplication> -#include <QVarLengthArray> -#include <string.h> + +#include "qmljsparser_p.h" +#include <QVarLengthArray> // // This file is automatically generated from qmljs.g. @@ -215,33 +215,43 @@ case 3: { } break; case 4: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; + +case 5: { + sym(1).Node = sym(2).Node; + program = sym(1).Node; +} break; + +case 6: { sym(1).UiProgram = makeAstNode<AST::UiProgram> (driver->nodePool(), sym(1).UiImportList, sym(2).UiObjectMemberList->finish()); } break; -case 6: { +case 8: { sym(1).Node = sym(1).UiImportList->finish(); } break; -case 7: { +case 9: { sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImport); } break; -case 8: { +case 10: { sym(1).Node = makeAstNode<AST::UiImportList> (driver->nodePool(), sym(1).UiImportList, sym(2).UiImport); } break; -case 11: { +case 13: { sym(1).UiImport->semicolonToken = loc(2); } break; -case 13: { +case 15: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->semicolonToken = loc(3); } break; -case 15: { +case 17: { sym(1).UiImport->versionToken = loc(2); sym(1).UiImport->asToken = loc(3); sym(1).UiImport->importIdToken = loc(4); @@ -249,14 +259,14 @@ case 15: { sym(1).UiImport->semicolonToken = loc(5); } break; -case 17: { +case 19: { sym(1).UiImport->asToken = loc(2); sym(1).UiImport->importIdToken = loc(3); sym(1).UiImport->importId = sym(3).sval; sym(1).UiImport->semicolonToken = loc(4); } break; -case 18: { +case 20: { AST::UiImport *node = 0; if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) { @@ -266,7 +276,7 @@ case 18: { QString text; for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) { text += q->name->asString(); - if (q->next) text += QLatin1Char('.'); + if (q->next) text += QLatin1String("."); } node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId); node->fileNameToken = loc(2); @@ -282,56 +292,56 @@ case 18: { } } break; -case 19: { +case 21: { sym(1).Node = 0; } break; -case 20: { +case 22: { sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember); } break; -case 21: { +case 23: { sym(1).Node = makeAstNode<AST::UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMember); } break; -case 22: { +case 24: { AST::UiObjectMemberList *node = makeAstNode<AST:: UiObjectMemberList> (driver->nodePool(), sym(1).UiObjectMemberList, sym(2).UiObjectMember); sym(1).Node = node; } break; -case 23: { +case 25: { sym(1).Node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(), sym(1).UiObjectMember); } break; -case 24: { +case 26: { AST::UiArrayMemberList *node = makeAstNode<AST::UiArrayMemberList> (driver->nodePool(), sym(1).UiArrayMemberList, sym(3).UiObjectMember); node->commaToken = loc(2); sym(1).Node = node; } break; -case 25: { +case 27: { AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), (AST::UiObjectMemberList*)0); node->lbraceToken = loc(1); node->rbraceToken = loc(2); sym(1).Node = node; } break; -case 26: { +case 28: { AST::UiObjectInitializer *node = makeAstNode<AST::UiObjectInitializer> (driver->nodePool(), sym(2).UiObjectMemberList->finish()); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 27: { +case 29: { AST::UiObjectDefinition *node = makeAstNode<AST::UiObjectDefinition> (driver->nodePool(), sym(1).UiQualifiedId, sym(2).UiObjectInitializer); sym(1).Node = node; } break; -case 29: { +case 31: { AST::UiArrayBinding *node = makeAstNode<AST::UiArrayBinding> (driver->nodePool(), sym(1).UiQualifiedId, sym(4).UiArrayMemberList->finish()); node->colonToken = loc(2); @@ -340,13 +350,13 @@ case 29: { sym(1).Node = node; } break; -case 30: { +case 32: { AST::UiObjectBinding *node = makeAstNode<AST::UiObjectBinding> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).UiQualifiedId, sym(4).UiObjectInitializer); node->colonToken = loc(2); sym(1).Node = node; } break; -case 31:case 32:case 33:case 34: +case 33:case 34:case 35:case 36: { AST::UiScriptBinding *node = makeAstNode<AST::UiScriptBinding> (driver->nodePool(), sym(1).UiQualifiedId, sym(3).Statement); @@ -354,35 +364,35 @@ case 31:case 32:case 33:case 34: sym(1).Node = node; } break; -case 35: +case 37: -case 36: { +case 38: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); break; } -case 38: { +case 40: { sym(1).Node = 0; } break; -case 39: { +case 41: { sym(1).Node = sym(1).UiParameterList->finish (); } break; -case 40: { +case 42: { AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).sval, sym(2).sval); node->identifierToken = loc(2); sym(1).Node = node; } break; -case 41: { +case 43: { AST::UiParameterList *node = makeAstNode<AST::UiParameterList> (driver->nodePool(), sym(1).UiParameterList, sym(3).sval, sym(4).sval); node->commaToken = loc(2); node->identifierToken = loc(4); sym(1).Node = node; } break; -case 43: { +case 45: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -393,7 +403,7 @@ case 43: { sym(1).Node = node; } break; -case 45: { +case 47: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), (NameId *)0, sym(2).sval); node->type = AST::UiPublicMember::Signal; node->propertyToken = loc(1); @@ -403,7 +413,7 @@ case 45: { sym(1).Node = node; } break; -case 47: { +case 49: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(4).sval, sym(6).sval); node->typeModifier = sym(2).sval; node->propertyToken = loc(1); @@ -414,7 +424,7 @@ case 47: { sym(1).Node = node; } break; -case 49: { +case 51: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval); node->propertyToken = loc(1); node->typeToken = loc(2); @@ -423,7 +433,7 @@ case 49: { sym(1).Node = node; } break; -case 51: { +case 53: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval); node->isDefaultMember = true; node->defaultToken = loc(1); @@ -434,7 +444,7 @@ case 51: { sym(1).Node = node; } break; -case 53: { +case 55: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(2).sval, sym(3).sval, sym(5).Expression); node->propertyToken = loc(1); @@ -445,7 +455,7 @@ case 53: { sym(1).Node = node; } break; -case 55: { +case 57: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval, sym(6).Expression); node->isReadonlyMember = true; @@ -458,7 +468,7 @@ case 55: { sym(1).Node = node; } break; -case 57: { +case 59: { AST::UiPublicMember *node = makeAstNode<AST::UiPublicMember> (driver->nodePool(), sym(3).sval, sym(4).sval, sym(6).Expression); node->isDefaultMember = true; @@ -471,75 +481,75 @@ case 57: { sym(1).Node = node; } break; -case 58: { +case 60: { sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node); } break; -case 59: { +case 61: { sym(1).Node = makeAstNode<AST::UiSourceElement>(driver->nodePool(), sym(1).Node); } break; -case 61: { +case 63: { QString s = QLatin1String(QmlJSGrammar::spell[T_PROPERTY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 62: { +case 64: { QString s = QLatin1String(QmlJSGrammar::spell[T_SIGNAL]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 63: { +case 65: { QString s = QLatin1String(QmlJSGrammar::spell[T_READONLY]); sym(1).sval = driver->intern(s.constData(), s.length()); break; } -case 64: { +case 66: { AST::ThisExpression *node = makeAstNode<AST::ThisExpression> (driver->nodePool()); node->thisToken = loc(1); sym(1).Node = node; } break; -case 65: { +case 67: { AST::IdentifierExpression *node = makeAstNode<AST::IdentifierExpression> (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 66: { +case 68: { AST::NullExpression *node = makeAstNode<AST::NullExpression> (driver->nodePool()); node->nullToken = loc(1); sym(1).Node = node; } break; -case 67: { +case 69: { AST::TrueLiteral *node = makeAstNode<AST::TrueLiteral> (driver->nodePool()); node->trueToken = loc(1); sym(1).Node = node; } break; -case 68: { +case 70: { AST::FalseLiteral *node = makeAstNode<AST::FalseLiteral> (driver->nodePool()); node->falseToken = loc(1); sym(1).Node = node; } break; -case 69: { +case 71: { AST::NumericLiteral *node = makeAstNode<AST::NumericLiteral> (driver->nodePool(), sym(1).dval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 70: -case 71: { +case 72: +case 73: { AST::StringLiteral *node = makeAstNode<AST::StringLiteral> (driver->nodePool(), sym(1).sval); node->literalToken = loc(1); sym(1).Node = node; } break; -case 72: { +case 74: { bool rx = lexer->scanRegExp(Lexer::NoPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -550,7 +560,7 @@ case 72: { sym(1).Node = node; } break; -case 73: { +case 75: { bool rx = lexer->scanRegExp(Lexer::EqualPrefix); if (!rx) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, location(lexer), lexer->errorMessage())); @@ -561,28 +571,28 @@ case 73: { sym(1).Node = node; } break; -case 74: { +case 76: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), (AST::Elision *) 0); node->lbracketToken = loc(1); node->rbracketToken = loc(2); sym(1).Node = node; } break; -case 75: { +case 77: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).Elision->finish()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 76: { +case 78: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish ()); node->lbracketToken = loc(1); node->rbracketToken = loc(3); sym(1).Node = node; } break; -case 77: { +case 79: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), (AST::Elision *) 0); node->lbracketToken = loc(1); @@ -591,7 +601,7 @@ case 77: { sym(1).Node = node; } break; -case 78: { +case 80: { AST::ArrayLiteral *node = makeAstNode<AST::ArrayLiteral> (driver->nodePool(), sym(2).ElementList->finish (), sym(4).Elision->finish()); node->lbracketToken = loc(1); @@ -600,7 +610,7 @@ case 78: { sym(1).Node = node; } break; -case 79: { +case 81: { AST::ObjectLiteral *node = 0; if (sym(2).Node) node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(), @@ -612,7 +622,7 @@ case 79: { sym(1).Node = node; } break; -case 80: { +case 82: { AST::ObjectLiteral *node = makeAstNode<AST::ObjectLiteral> (driver->nodePool(), sym(2).PropertyNameAndValueList->finish ()); node->lbraceToken = loc(1); @@ -620,14 +630,14 @@ case 80: { sym(1).Node = node; } break; -case 81: { +case 83: { AST::NestedExpression *node = makeAstNode<AST::NestedExpression>(driver->nodePool(), sym(2).Expression); node->lparenToken = loc(1); node->rparenToken = loc(3); sym(1).Node = node; } break; -case 82: { +case 84: { if (AST::ArrayMemberExpression *mem = AST::cast<AST::ArrayMemberExpression *>(sym(1).Expression)) { diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, mem->lbracketToken, QLatin1String("Ignored annotation"))); @@ -647,48 +657,48 @@ case 82: { } } break; -case 83: { +case 85: { sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), (AST::Elision *) 0, sym(1).Expression); } break; -case 84: { +case 86: { sym(1).Node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).Elision->finish(), sym(2).Expression); } break; -case 85: { +case 87: { AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, (AST::Elision *) 0, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 86: { +case 88: { AST::ElementList *node = makeAstNode<AST::ElementList> (driver->nodePool(), sym(1).ElementList, sym(3).Elision->finish(), sym(4).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 87: { +case 89: { AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool()); node->commaToken = loc(1); sym(1).Node = node; } break; -case 88: { +case 90: { AST::Elision *node = makeAstNode<AST::Elision> (driver->nodePool(), sym(1).Elision); node->commaToken = loc(2); sym(1).Node = node; } break; -case 89: { +case 91: { AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyName, sym(3).Expression); node->colonToken = loc(2); sym(1).Node = node; } break; -case 90: { +case 92: { AST::PropertyNameAndValueList *node = makeAstNode<AST::PropertyNameAndValueList> (driver->nodePool(), sym(1).PropertyNameAndValueList, sym(3).PropertyName, sym(5).Expression); node->commaToken = loc(2); @@ -696,40 +706,36 @@ case 90: { sym(1).Node = node; } break; -case 91: { +case 93: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 92: -case 93: { +case 94: +case 95: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount())); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 94: { +case 96: { AST::StringLiteralPropertyName *node = makeAstNode<AST::StringLiteralPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 95: { +case 97: { AST::NumericLiteralPropertyName *node = makeAstNode<AST::NumericLiteralPropertyName> (driver->nodePool(), sym(1).dval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 96: { +case 98: { AST::IdentifierPropertyName *node = makeAstNode<AST::IdentifierPropertyName> (driver->nodePool(), sym(1).sval); node->propertyNameToken = loc(1); sym(1).Node = node; } break; -case 97: - -case 98: - case 99: case 100: @@ -787,25 +793,29 @@ case 125: case 126: case 127: + +case 128: + +case 129: { sym(1).sval = driver->intern(lexer->characterBuffer(), lexer->characterCount()); } break; -case 132: { +case 134: { AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 133: { +case 135: { AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 134: { +case 136: { AST::NewMemberExpression *node = makeAstNode<AST::NewMemberExpression> (driver->nodePool(), sym(2).Expression, sym(4).ArgumentList); node->newToken = loc(1); node->lparenToken = loc(3); @@ -813,316 +823,309 @@ case 134: { sym(1).Node = node; } break; -case 136: { +case 138: { AST::NewExpression *node = makeAstNode<AST::NewExpression> (driver->nodePool(), sym(2).Expression); node->newToken = loc(1); sym(1).Node = node; } break; -case 137: { +case 139: { AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 138: { +case 140: { AST::CallExpression *node = makeAstNode<AST::CallExpression> (driver->nodePool(), sym(1).Expression, sym(3).ArgumentList); node->lparenToken = loc(2); node->rparenToken = loc(4); sym(1).Node = node; } break; -case 139: { +case 141: { AST::ArrayMemberExpression *node = makeAstNode<AST::ArrayMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->lbracketToken = loc(2); node->rbracketToken = loc(4); sym(1).Node = node; } break; -case 140: { +case 142: { AST::FieldMemberExpression *node = makeAstNode<AST::FieldMemberExpression> (driver->nodePool(), sym(1).Expression, sym(3).sval); node->dotToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 141: { +case 143: { sym(1).Node = 0; } break; -case 142: { +case 144: { sym(1).Node = sym(1).ArgumentList->finish(); } break; -case 143: { +case 145: { sym(1).Node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).Expression); } break; -case 144: { +case 146: { AST::ArgumentList *node = makeAstNode<AST::ArgumentList> (driver->nodePool(), sym(1).ArgumentList, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 148: { +case 150: { AST::PostIncrementExpression *node = makeAstNode<AST::PostIncrementExpression> (driver->nodePool(), sym(1).Expression); node->incrementToken = loc(2); sym(1).Node = node; } break; -case 149: { +case 151: { AST::PostDecrementExpression *node = makeAstNode<AST::PostDecrementExpression> (driver->nodePool(), sym(1).Expression); node->decrementToken = loc(2); sym(1).Node = node; } break; -case 151: { +case 153: { AST::DeleteExpression *node = makeAstNode<AST::DeleteExpression> (driver->nodePool(), sym(2).Expression); node->deleteToken = loc(1); sym(1).Node = node; } break; -case 152: { +case 154: { AST::VoidExpression *node = makeAstNode<AST::VoidExpression> (driver->nodePool(), sym(2).Expression); node->voidToken = loc(1); sym(1).Node = node; } break; -case 153: { +case 155: { AST::TypeOfExpression *node = makeAstNode<AST::TypeOfExpression> (driver->nodePool(), sym(2).Expression); node->typeofToken = loc(1); sym(1).Node = node; } break; -case 154: { +case 156: { AST::PreIncrementExpression *node = makeAstNode<AST::PreIncrementExpression> (driver->nodePool(), sym(2).Expression); node->incrementToken = loc(1); sym(1).Node = node; } break; -case 155: { +case 157: { AST::PreDecrementExpression *node = makeAstNode<AST::PreDecrementExpression> (driver->nodePool(), sym(2).Expression); node->decrementToken = loc(1); sym(1).Node = node; } break; -case 156: { +case 158: { AST::UnaryPlusExpression *node = makeAstNode<AST::UnaryPlusExpression> (driver->nodePool(), sym(2).Expression); node->plusToken = loc(1); sym(1).Node = node; } break; -case 157: { +case 159: { AST::UnaryMinusExpression *node = makeAstNode<AST::UnaryMinusExpression> (driver->nodePool(), sym(2).Expression); node->minusToken = loc(1); sym(1).Node = node; } break; -case 158: { +case 160: { AST::TildeExpression *node = makeAstNode<AST::TildeExpression> (driver->nodePool(), sym(2).Expression); node->tildeToken = loc(1); sym(1).Node = node; } break; -case 159: { +case 161: { AST::NotExpression *node = makeAstNode<AST::NotExpression> (driver->nodePool(), sym(2).Expression); node->notToken = loc(1); sym(1).Node = node; } break; -case 161: { +case 163: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mul, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 162: { +case 164: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Div, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 163: { +case 165: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Mod, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 165: { +case 167: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Add, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 166: { +case 168: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Sub, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 168: { +case 170: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::LShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 169: { +case 171: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::RShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 170: { +case 172: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::URShift, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 172: { +case 174: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 173: { +case 175: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 174: { +case 176: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 175: { +case 177: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 176: { +case 178: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 177: { +case 179: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::In, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 179: { +case 181: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Lt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 180: { +case 182: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Gt, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 181: { +case 183: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Le, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 182: { +case 184: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Ge, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 183: { +case 185: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::InstanceOf, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 185: { +case 187: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 186: { +case 188: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 187: { +case 189: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 188: { +case 190: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 190: { +case 192: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::Equal, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 191: { +case 193: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::NotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 192: { +case 194: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, QSOperator::StrictEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 193: { - AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::StrictNotEqual, sym(3).Expression); - node->operatorToken = loc(2); - sym(1).Node = node; -} break; - case 195: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::BitAnd, sym(3).Expression); + QSOperator::StrictNotEqual, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1136,7 +1139,7 @@ case 197: { case 199: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::BitXor, sym(3).Expression); + QSOperator::BitAnd, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1150,7 +1153,7 @@ case 201: { case 203: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::BitOr, sym(3).Expression); + QSOperator::BitXor, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1164,7 +1167,7 @@ case 205: { case 207: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::And, sym(3).Expression); + QSOperator::BitOr, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1178,7 +1181,7 @@ case 209: { case 211: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, - QSOperator::Or, sym(3).Expression); + QSOperator::And, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; @@ -1191,6 +1194,13 @@ case 213: { } break; case 215: { + AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, + QSOperator::Or, sym(3).Expression); + node->operatorToken = loc(2); + sym(1).Node = node; +} break; + +case 217: { AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1198,7 +1208,7 @@ case 215: { sym(1).Node = node; } break; -case 217: { +case 219: { AST::ConditionalExpression *node = makeAstNode<AST::ConditionalExpression> (driver->nodePool(), sym(1).Expression, sym(3).Expression, sym(5).Expression); node->questionToken = loc(2); @@ -1206,112 +1216,112 @@ case 217: { sym(1).Node = node; } break; -case 219: { +case 221: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 221: { +case 223: { AST::BinaryExpression *node = makeAstNode<AST::BinaryExpression> (driver->nodePool(), sym(1).Expression, sym(2).ival, sym(3).Expression); node->operatorToken = loc(2); sym(1).Node = node; } break; -case 222: { +case 224: { sym(1).ival = QSOperator::Assign; } break; -case 223: { +case 225: { sym(1).ival = QSOperator::InplaceMul; } break; -case 224: { +case 226: { sym(1).ival = QSOperator::InplaceDiv; } break; -case 225: { +case 227: { sym(1).ival = QSOperator::InplaceMod; } break; -case 226: { +case 228: { sym(1).ival = QSOperator::InplaceAdd; } break; -case 227: { +case 229: { sym(1).ival = QSOperator::InplaceSub; } break; -case 228: { +case 230: { sym(1).ival = QSOperator::InplaceLeftShift; } break; -case 229: { +case 231: { sym(1).ival = QSOperator::InplaceRightShift; } break; -case 230: { +case 232: { sym(1).ival = QSOperator::InplaceURightShift; } break; -case 231: { +case 233: { sym(1).ival = QSOperator::InplaceAnd; } break; -case 232: { +case 234: { sym(1).ival = QSOperator::InplaceXor; } break; -case 233: { +case 235: { sym(1).ival = QSOperator::InplaceOr; } break; -case 235: { +case 237: { AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 236: { +case 238: { sym(1).Node = 0; } break; -case 239: { +case 241: { AST::Expression *node = makeAstNode<AST::Expression> (driver->nodePool(), sym(1).Expression, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; -case 240: { +case 242: { sym(1).Node = 0; } break; -case 257: { +case 259: { AST::Block *node = makeAstNode<AST::Block> (driver->nodePool(), sym(2).StatementList); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 258: { +case 260: { sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).Statement); } break; -case 259: { +case 261: { sym(1).Node = makeAstNode<AST::StatementList> (driver->nodePool(), sym(1).StatementList, sym(2).Statement); } break; -case 260: { +case 262: { sym(1).Node = 0; } break; -case 261: { +case 263: { sym(1).Node = sym(1).StatementList->finish (); } break; -case 263: { +case 265: { AST::VariableStatement *node = makeAstNode<AST::VariableStatement> (driver->nodePool(), sym(2).VariableDeclarationList->finish (/*readOnly=*/sym(1).ival == T_CONST)); node->declarationKindToken = loc(1); @@ -1319,76 +1329,76 @@ case 263: { sym(1).Node = node; } break; -case 264: { +case 266: { sym(1).ival = T_CONST; } break; -case 265: { +case 267: { sym(1).ival = T_VAR; } break; -case 266: { +case 268: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 267: { +case 269: { AST::VariableDeclarationList *node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); node->commaToken = loc(2); sym(1).Node = node; } break; -case 268: { +case 270: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclaration); } break; -case 269: { +case 271: { sym(1).Node = makeAstNode<AST::VariableDeclarationList> (driver->nodePool(), sym(1).VariableDeclarationList, sym(3).VariableDeclaration); } break; -case 270: { +case 272: { AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 271: { +case 273: { AST::VariableDeclaration *node = makeAstNode<AST::VariableDeclaration> (driver->nodePool(), sym(1).sval, sym(2).Expression); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 272: { +case 274: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 273: { +case 275: { sym(1).Node = 0; } break; -case 275: { +case 277: { // ### TODO: AST for initializer sym(1) = sym(2); } break; -case 276: { +case 278: { sym(1).Node = 0; } break; -case 278: { +case 280: { AST::EmptyStatement *node = makeAstNode<AST::EmptyStatement> (driver->nodePool()); node->semicolonToken = loc(1); sym(1).Node = node; } break; -case 280: { +case 282: { AST::ExpressionStatement *node = makeAstNode<AST::ExpressionStatement> (driver->nodePool(), sym(1).Expression); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 281: { +case 283: { AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement, sym(7).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1397,7 +1407,7 @@ case 281: { sym(1).Node = node; } break; -case 282: { +case 284: { AST::IfStatement *node = makeAstNode<AST::IfStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->ifToken = loc(1); node->lparenToken = loc(2); @@ -1405,7 +1415,7 @@ case 282: { sym(1).Node = node; } break; -case 284: { +case 286: { AST::DoWhileStatement *node = makeAstNode<AST::DoWhileStatement> (driver->nodePool(), sym(2).Statement, sym(5).Expression); node->doToken = loc(1); node->whileToken = loc(3); @@ -1415,7 +1425,7 @@ case 284: { sym(1).Node = node; } break; -case 285: { +case 287: { AST::WhileStatement *node = makeAstNode<AST::WhileStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->whileToken = loc(1); node->lparenToken = loc(2); @@ -1423,7 +1433,7 @@ case 285: { sym(1).Node = node; } break; -case 286: { +case 288: { AST::ForStatement *node = makeAstNode<AST::ForStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Expression, sym(9).Statement); node->forToken = loc(1); @@ -1434,7 +1444,7 @@ case 286: { sym(1).Node = node; } break; -case 287: { +case 289: { AST::LocalForStatement *node = makeAstNode<AST::LocalForStatement> (driver->nodePool(), sym(4).VariableDeclarationList->finish (/*readOnly=*/false), sym(6).Expression, sym(8).Expression, sym(10).Statement); @@ -1447,7 +1457,7 @@ case 287: { sym(1).Node = node; } break; -case 288: { +case 290: { AST:: ForEachStatement *node = makeAstNode<AST::ForEachStatement> (driver->nodePool(), sym(3).Expression, sym(5).Expression, sym(7).Statement); node->forToken = loc(1); @@ -1457,7 +1467,7 @@ case 288: { sym(1).Node = node; } break; -case 289: { +case 291: { AST::LocalForEachStatement *node = makeAstNode<AST::LocalForEachStatement> (driver->nodePool(), sym(4).VariableDeclaration, sym(6).Expression, sym(8).Statement); node->forToken = loc(1); @@ -1468,14 +1478,14 @@ case 289: { sym(1).Node = node; } break; -case 291: { +case 293: { AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool()); node->continueToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 293: { +case 295: { AST::ContinueStatement *node = makeAstNode<AST::ContinueStatement> (driver->nodePool(), sym(2).sval); node->continueToken = loc(1); node->identifierToken = loc(2); @@ -1483,14 +1493,14 @@ case 293: { sym(1).Node = node; } break; -case 295: { +case 297: { AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool()); node->breakToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 297: { +case 299: { AST::BreakStatement *node = makeAstNode<AST::BreakStatement> (driver->nodePool(), sym(2).sval); node->breakToken = loc(1); node->identifierToken = loc(2); @@ -1498,14 +1508,14 @@ case 297: { sym(1).Node = node; } break; -case 299: { +case 301: { AST::ReturnStatement *node = makeAstNode<AST::ReturnStatement> (driver->nodePool(), sym(2).Expression); node->returnToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 300: { +case 302: { AST::WithStatement *node = makeAstNode<AST::WithStatement> (driver->nodePool(), sym(3).Expression, sym(5).Statement); node->withToken = loc(1); node->lparenToken = loc(2); @@ -1513,7 +1523,7 @@ case 300: { sym(1).Node = node; } break; -case 301: { +case 303: { AST::SwitchStatement *node = makeAstNode<AST::SwitchStatement> (driver->nodePool(), sym(3).Expression, sym(5).CaseBlock); node->switchToken = loc(1); node->lparenToken = loc(2); @@ -1521,90 +1531,90 @@ case 301: { sym(1).Node = node; } break; -case 302: { +case 304: { AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(3); sym(1).Node = node; } break; -case 303: { +case 305: { AST::CaseBlock *node = makeAstNode<AST::CaseBlock> (driver->nodePool(), sym(2).CaseClauses, sym(3).DefaultClause, sym(4).CaseClauses); node->lbraceToken = loc(1); node->rbraceToken = loc(5); sym(1).Node = node; } break; -case 304: { +case 306: { sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClause); } break; -case 305: { +case 307: { sym(1).Node = makeAstNode<AST::CaseClauses> (driver->nodePool(), sym(1).CaseClauses, sym(2).CaseClause); } break; -case 306: { +case 308: { sym(1).Node = 0; } break; -case 307: { +case 309: { sym(1).Node = sym(1).CaseClauses->finish (); } break; -case 308: { +case 310: { AST::CaseClause *node = makeAstNode<AST::CaseClause> (driver->nodePool(), sym(2).Expression, sym(4).StatementList); node->caseToken = loc(1); node->colonToken = loc(3); sym(1).Node = node; } break; -case 309: { +case 311: { AST::DefaultClause *node = makeAstNode<AST::DefaultClause> (driver->nodePool(), sym(3).StatementList); node->defaultToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 310: -case 311: { +case 312: +case 313: { AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), driver->intern(lexer->characterBuffer(), lexer->characterCount()), sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 312: { +case 314: { AST::LabelledStatement *node = makeAstNode<AST::LabelledStatement> (driver->nodePool(), sym(1).sval, sym(3).Statement); node->identifierToken = loc(1); node->colonToken = loc(2); sym(1).Node = node; } break; -case 314: { +case 316: { AST::ThrowStatement *node = makeAstNode<AST::ThrowStatement> (driver->nodePool(), sym(2).Expression); node->throwToken = loc(1); node->semicolonToken = loc(3); sym(1).Node = node; } break; -case 315: { +case 317: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch); node->tryToken = loc(1); sym(1).Node = node; } break; -case 316: { +case 318: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 317: { +case 319: { AST::TryStatement *node = makeAstNode<AST::TryStatement> (driver->nodePool(), sym(2).Statement, sym(3).Catch, sym(4).Finally); node->tryToken = loc(1); sym(1).Node = node; } break; -case 318: { +case 320: { AST::Catch *node = makeAstNode<AST::Catch> (driver->nodePool(), sym(3).sval, sym(5).Block); node->catchToken = loc(1); node->lparenToken = loc(2); @@ -1613,20 +1623,20 @@ case 318: { sym(1).Node = node; } break; -case 319: { +case 321: { AST::Finally *node = makeAstNode<AST::Finally> (driver->nodePool(), sym(2).Block); node->finallyToken = loc(1); sym(1).Node = node; } break; -case 321: { +case 323: { AST::DebuggerStatement *node = makeAstNode<AST::DebuggerStatement> (driver->nodePool()); node->debuggerToken = loc(1); node->semicolonToken = loc(2); sym(1).Node = node; } break; -case 322: { +case 324: { AST::FunctionDeclaration *node = makeAstNode<AST::FunctionDeclaration> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); node->identifierToken = loc(2); @@ -1637,7 +1647,7 @@ case 322: { sym(1).Node = node; } break; -case 323: { +case 325: { AST::FunctionExpression *node = makeAstNode<AST::FunctionExpression> (driver->nodePool(), sym(2).sval, sym(4).FormalParameterList, sym(7).FunctionBody); node->functionToken = loc(1); if (sym(2).sval) @@ -1649,56 +1659,60 @@ case 323: { sym(1).Node = node; } break; -case 324: { +case 326: { AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).sval); node->identifierToken = loc(1); sym(1).Node = node; } break; -case 325: { +case 327: { AST::FormalParameterList *node = makeAstNode<AST::FormalParameterList> (driver->nodePool(), sym(1).FormalParameterList, sym(3).sval); node->commaToken = loc(2); node->identifierToken = loc(3); sym(1).Node = node; } break; -case 326: { +case 328: { sym(1).Node = 0; } break; -case 327: { +case 329: { sym(1).Node = sym(1).FormalParameterList->finish (); } break; -case 328: { +case 330: { sym(1).Node = 0; } break; -case 330: { +case 332: { sym(1).Node = makeAstNode<AST::FunctionBody> (driver->nodePool(), sym(1).SourceElements->finish ()); } break; -case 331: { +case 333: { + sym(1).Node = makeAstNode<AST::Program> (driver->nodePool(), sym(1).SourceElements->finish ()); +} break; + +case 334: { sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElement); } break; -case 332: { +case 335: { sym(1).Node = makeAstNode<AST::SourceElements> (driver->nodePool(), sym(1).SourceElements, sym(2).SourceElement); } break; -case 333: { +case 336: { sym(1).Node = makeAstNode<AST::StatementSourceElement> (driver->nodePool(), sym(1).Statement); } break; -case 334: { +case 337: { sym(1).Node = makeAstNode<AST::FunctionSourceElement> (driver->nodePool(), sym(1).FunctionDeclaration); } break; -case 335: { +case 338: { sym(1).sval = 0; } break; -case 337: { +case 340: { sym(1).Node = 0; } break; @@ -1722,7 +1736,7 @@ case 337: { yylloc.startColumn += yylloc.length; yylloc.length = 0; - //const QString msg = QCoreApplication::translate("QmlParser", "Missing `;'"); + //const QString msg = qApp->translate("QmlParser", "Missing `;'"); //diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg)); first_token = &token_buffer[0]; @@ -1747,7 +1761,12 @@ case 337: { token_buffer[1].loc = yylloc = location(lexer); if (t_action(errorState, yytoken)) { - const QString msg = QCoreApplication::translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token])); + QString msg; + int token = token_buffer[0].token; + if (token < 0 || token >= TERMINAL_COUNT) + msg = qApp->translate("QmlParser", "Syntax error"); + else + msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); action = errorState; @@ -1775,7 +1794,7 @@ case 337: { for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) { int a = t_action(errorState, *tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk])); + const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = *tk; @@ -1793,12 +1812,13 @@ case 337: { for (int tk = 1; tk < TERMINAL_COUNT; ++tk) { if (tk == T_AUTOMATIC_SEMICOLON || tk == T_FEED_UI_PROGRAM || - tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION) + tk == T_FEED_JS_STATEMENT || tk == T_FEED_JS_EXPRESSION || + tk == T_FEED_JS_SOURCE_ELEMENT) continue; int a = t_action(errorState, tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk])); + const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = tk; @@ -1811,7 +1831,7 @@ case 337: { } } - const QString msg = QCoreApplication::translate("QmlParser", "Syntax error"); + const QString msg = qApp->translate("QmlParser", "Syntax error"); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); } diff --git a/src/declarative/qml/parser/qmljsparser_p.h b/src/declarative/qml/parser/qmljsparser_p.h index 2cefb5c..42fb422 100644 --- a/src/declarative/qml/parser/qmljsparser_p.h +++ b/src/declarative/qml/parser/qmljsparser_p.h @@ -1,8 +1,6 @@ -// This file was generated by qlalr - DO NOT EDIT! - /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -41,6 +39,7 @@ ** ****************************************************************************/ + // // W A R N I N G // ------------- @@ -133,7 +132,9 @@ public: bool parse() { return parse(T_FEED_UI_PROGRAM); } bool parseStatement() { return parse(T_FEED_JS_STATEMENT); } bool parseExpression() { return parse(T_FEED_JS_EXPRESSION); } + bool parseSourceElement() { return parse(T_FEED_JS_SOURCE_ELEMENT); } bool parseUiObjectMember() { return parse(T_FEED_UI_OBJECT_MEMBER); } + bool parseProgram() { return parse(T_FEED_JS_PROGRAM); } AST::UiProgram *ast() const { return AST::cast<AST::UiProgram *>(program); } @@ -162,6 +163,9 @@ public: return program->uiObjectMemberCast(); } + AST::Node *rootNode() const + { return program; } + QList<DiagnosticMessage> diagnosticMessages() const { return diagnostic_messages; } @@ -231,9 +235,9 @@ protected: -#define J_SCRIPT_REGEXPLITERAL_RULE1 72 +#define J_SCRIPT_REGEXPLITERAL_RULE1 74 -#define J_SCRIPT_REGEXPLITERAL_RULE2 73 +#define J_SCRIPT_REGEXPLITERAL_RULE2 75 QT_QML_END_NAMESPACE diff --git a/src/declarative/qml/qml.pri b/src/declarative/qml/qml.pri index 1b35442..cd2fbff 100644 --- a/src/declarative/qml/qml.pri +++ b/src/declarative/qml/qml.pri @@ -1,5 +1,4 @@ INCLUDEPATH += $$PWD - SOURCES += \ $$PWD/qmlparser.cpp \ $$PWD/qmlinstruction.cpp \ @@ -32,10 +31,8 @@ SOURCES += \ $$PWD/qmlscriptparser.cpp \ $$PWD/qmlenginedebug.cpp \ $$PWD/qmlrewrite.cpp \ - $$PWD/qmlbasicscript.cpp \ - $$PWD/qmlbindingvme.cpp \ $$PWD/qmlvaluetype.cpp \ - $$PWD/qmlbindingoptimizations.cpp \ + $$PWD/qmlcompiledbindings.cpp \ $$PWD/qmlxmlhttprequest.cpp \ $$PWD/qmlsqldatabase.cpp \ $$PWD/qmetaobjectbuilder.cpp \ @@ -52,8 +49,8 @@ SOURCES += \ $$PWD/qmlvaluetypescriptclass.cpp \ $$PWD/qmltypenamescriptclass.cpp \ $$PWD/qmllistscriptclass.cpp \ - $$PWD/qmlworkerscript.cpp - + $$PWD/qmlworkerscript.cpp \ + $$PWD/qmlnetworkaccessmanagerfactory.cpp HEADERS += \ $$PWD/qmlparser_p.h \ $$PWD/qmlglobal_p.h \ @@ -96,14 +93,12 @@ HEADERS += \ $$PWD/qmldeclarativedata_p.h \ $$PWD/qmlerror.h \ $$PWD/qmlscriptparser_p.h \ - $$PWD/qmlbasicscript_p.h \ - $$PWD/qmlbindingvme_p.h \ $$PWD/qmlenginedebug_p.h \ $$PWD/qmlrewrite_p.h \ $$PWD/qpodvector_p.h \ $$PWD/qbitfield_p.h \ $$PWD/qmlvaluetype_p.h \ - $$PWD/qmlbindingoptimizations_p.h \ + $$PWD/qmlcompiledbindings_p.h \ $$PWD/qmlxmlhttprequest_p.h \ $$PWD/qmlsqldatabase_p.h \ $$PWD/qmetaobjectbuilder_p.h \ @@ -119,10 +114,10 @@ HEADERS += \ $$PWD/qmlvaluetypescriptclass_p.h \ $$PWD/qmltypenamescriptclass_p.h \ $$PWD/qmllistscriptclass_p.h \ - $$PWD/qmlworkerscript_p.h - + $$PWD/qmlworkerscript_p.h \ + $$PWD/qmlscriptclass_p.h \ + $$PWD/qmlguard_p.h \ + $$PWD/qmlnetworkaccessmanagerfactory.h QT += sql - include(parser/parser.pri) include(rewriter/rewriter.pri) - diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp deleted file mode 100644 index 3d566c7..0000000 --- a/src/declarative/qml/qmlbasicscript.cpp +++ /dev/null @@ -1,760 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlbasicscript_p.h" - -#include "qmlengine_p.h" -#include "qmlcontext_p.h" -#include "qmlrefcount_p.h" -#include "qmlglobal_p.h" - -#include <qfxperf_p_p.h> -#include <qmljsast_p.h> -#include <qmljsengine_p.h> - -#include <QColor> -#include <QDebug> -#include <QStack> - -QT_BEGIN_NAMESPACE - -DEFINE_BOOL_CONFIG_OPTION(qmlBasicScriptDump, QML_BASICSCRIPT_DUMP); - -using namespace QmlJS; - -struct ScriptInstruction { - enum { - LoadIdObject, // fetch - FetchConstant, // constant - FetchContextConstant, // constant - FetchRootConstant, // constant - - Equals, // NA - - Int, // integer - Bool, // boolean - } type; - - union { - struct { - int idx; - } fetch; - struct { - int value; - } integer; - struct { - bool value; - } boolean; - struct { - short idx; - short notify; - int type; - } constant; - }; -}; - -class QmlBasicScriptPrivate -{ -public: - enum Flags { OwnData = 0x00000001 }; - - int size; - int stateSize; - int instructionCount; - int exprLen; - - ScriptInstruction *instructions() const { return (ScriptInstruction *)((char *)this + sizeof(QmlBasicScriptPrivate)); } - - const char *expr() const - { - return (const char *)(instructions() + instructionCount); - } - - const char *data() const - { - return (const char *)(instructions() + instructionCount) + exprLen + 1; - } - - static unsigned int alignRound(int s) - { - if (s % 4) - s += 4 - (s % 4); - return s; - } -}; - -// anchors.left: (nop convert)(qobject)parent.(anchorline)right - -/* - Property chains: a.b.c.d - if else value selection statements: if(a) b else if(c) d else e - trinary selection: a?b:c - addition: a + b - negation: a - a - equality: == -*/ -static QVariant fetch_value(QObject *o, int idx, int type) -{ - if (!o) - return QVariant(); - - switch(type) { - case QVariant::String: - { - QString val; - void *args[] = { &val, 0 }; - QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); - return QVariant(val); - } - break; - case QVariant::UInt: - { - uint val; - void *args[] = { &val, 0 }; - QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); - return QVariant(val); - } - break; - case QVariant::Int: - { - int val; - void *args[] = { &val, 0 }; - QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); - return QVariant(val); - } - break; - case QMetaType::Float: - { - float val; - void *args[] = { &val, 0 }; - QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); - return QVariant(val); - } - break; - case QVariant::Double: - { - double val; - void *args[] = { &val, 0 }; - QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); - return QVariant(val); - } - break; - case QVariant::Color: - { - QColor val; - void *args[] = { &val, 0 }; - QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); - return QVariant(val); - } - break; - case QVariant::Bool: - { - bool val; - void *args[] = { &val, 0 }; - QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); - return QVariant(val); - } - break; - default: - { - // If the object is null, we extract the predicted type. While this isn't - // 100% reliable, in many cases it gives us better error messages if we - // assign this null-object to an incompatible property - if (QmlMetaType::isObject(type)) { - // NOTE: This assumes a cast to QObject does not alter the - // object pointer - QObject *val = 0; - void *args[] = { &val, 0 }; - QMetaObject::metacall(o, QMetaObject::ReadProperty, idx, args); - if (!val) return QVariant(type, &val); - else return QVariant::fromValue(val); - } else { - QVariant var = o->metaObject()->property(idx).read(o); - if (QmlMetaType::isObject(var.userType())) { - QObject *obj = 0; - obj = *(QObject **)var.data(); - if (!obj) var = QVariant(var.userType(), &obj); - else var = QVariant::fromValue(obj); - } - return var; - } - } - break; - }; -} - -struct QmlBasicScriptCompiler -{ - QmlBasicScriptCompiler() - : script(0), stateSize(0) {} - - QmlBasicScript *script; - int stateSize; - - QmlParser::Object *context; - QmlParser::Object *component; - QHash<QString, QmlParser::Object *> ids; - - bool compile(QmlJS::AST::Node *); - - bool compileExpression(QmlJS::AST::Node *); - - bool tryConstant(QmlJS::AST::Node *); - bool parseConstant(QmlJS::AST::Node *); - bool tryName(QmlJS::AST::Node *); - bool parseName(QmlJS::AST::Node *); - - bool buildName(QStringList &, QmlJS::AST::Node *); - const QMetaObject *fetch(int type, const QMetaObject *, int idx); - - bool tryBinaryExpression(QmlJS::AST::Node *); - bool compileBinaryExpression(QmlJS::AST::Node *); - - QByteArray data; - QList<ScriptInstruction> bytecode; -}; - -/*! - \internal - \class QmlBasicScript - \brief The QmlBasicScript class provides a fast implementation of a limited subset of QmlJS bindings. - - QmlBasicScript instances are used to accelerate binding. Instead of using - the slower, fully fledged QmlJS engine, many simple bindings can be - evaluated using the QmlBasicScript engine. - - To see if the QmlBasicScript engine can handle a binding, call compile() - and check the return value, or isValid() afterwards. - - To accelerate binding, QmlBasicScript can return a precompiled - version of itself that can be saved for future use. Call compileData() to - get an opaque pointer to the compiled state, and compileDataSize() for the - size of this data in bytes. This data can be saved and passed to future - instances of the QmlBasicScript constructor. The initial copy of compile - data is owned by the QmlBindScript instance on which compile() was called. -*/ - -/*! - Create a new QmlBasicScript instance. -*/ -QmlBasicScript::QmlBasicScript() -: flags(0), d(0), rc(0) -{ -} - -/*! - Load the QmlBasicScript instance with saved \a data. - - \a data \b must be data previously acquired from calling compileData() on a - previously created QmlBasicScript instance. Any other data will almost - certainly cause the QmlBasicScript engine to crash. - - \a data must continue to be valid throughout the QmlBasicScript instance - life. It does not assume ownership of the memory. - - If \a owner is set, it is referenced on creation and dereferenced on - destruction of this instance. -*/ - -void QmlBasicScript::load(const char *data, QmlRefCount *owner) -{ - clear(); - d = (QmlBasicScriptPrivate *)data; - rc = owner; - if (rc) rc->addref(); -} - -/*! - Return the text of the script expression. - */ -QByteArray QmlBasicScript::expression() const -{ - if (!d) - return QByteArray(); - else - return QByteArray(d->expr()); -} - -/*! - Destroy the script instance. -*/ -QmlBasicScript::~QmlBasicScript() -{ - clear(); -} - -/*! - Clear this script. The object will then be in its initial state, as though - it were freshly constructed with default constructor. -*/ -void QmlBasicScript::clear() -{ - if (flags & QmlBasicScriptPrivate::OwnData) - free(d); - if (rc) rc->release(); - d = 0; - rc = 0; - flags = 0; -} - -/*! - Dump the script instructions to stderr for debugging. - */ -void QmlBasicScript::dump() -{ - if (!d) - return; - - qWarning() << d->instructionCount << "instructions:"; - for (int ii = 0; ii < d->instructionCount; ++ii) { - const ScriptInstruction &instr = d->instructions()[ii]; - - switch(instr.type) { - case ScriptInstruction::LoadIdObject: - qWarning().nospace() << "LOAD_ID_OBJECT"; - break; - case ScriptInstruction::FetchConstant: - qWarning().nospace() << "FETCH_CONSTANT"; - break; - case ScriptInstruction::FetchContextConstant: - qWarning().nospace() << "FETCH_CONTEXT_CONSTANT"; - break; - case ScriptInstruction::FetchRootConstant: - qWarning().nospace() << "FETCH_ROOT_CONSTANT"; - break; - case ScriptInstruction::Equals: - qWarning().nospace() << "EQUALS"; - break; - case ScriptInstruction::Int: - qWarning().nospace() << "INT\t\t" << instr.integer.value; - break; - case ScriptInstruction::Bool: - qWarning().nospace() << "BOOL\t\t" << instr.boolean.value; - break; - default: - qWarning().nospace() << "UNKNOWN"; - break; - } - } -} - -/*! - Return true if this is a valid script binding, otherwise returns false. - */ -bool QmlBasicScript::isValid() const -{ - return d != 0; -} - -bool QmlBasicScript::compile(const Expression &expression) -{ - if (!expression.expression.asAST()) return false; - - QByteArray expr = expression.expression.asScript().toUtf8(); - const char *src = expr.constData(); - - QmlBasicScriptCompiler bsc; - bsc.script = this; - bsc.context = expression.context; - bsc.component = expression.component; - bsc.ids = expression.ids; - - if (d) { - if (flags & QmlBasicScriptPrivate::OwnData) - free(d); - d = 0; - flags = 0; - } - - if (bsc.compile(expression.expression.asAST())) { - int len = ::strlen(src); - flags = QmlBasicScriptPrivate::OwnData; - int size = sizeof(QmlBasicScriptPrivate) + - bsc.bytecode.count() * sizeof(ScriptInstruction) + - QmlBasicScriptPrivate::alignRound(bsc.data.count() + len + 1); - d = (QmlBasicScriptPrivate *) malloc(size); - d->size = size; - d->stateSize = bsc.stateSize; - d->instructionCount = bsc.bytecode.count(); - d->exprLen = len; - ::memcpy((char *)d->expr(), src, len + 1); - for (int ii = 0; ii < d->instructionCount; ++ii) - d->instructions()[ii] = bsc.bytecode.at(ii); - ::memcpy((char *)d->data(), bsc.data.constData(), bsc.data.count()); - } - - if (d && qmlBasicScriptDump()) - dump(); - return d != 0; -} - -bool QmlBasicScriptCompiler::compile(QmlJS::AST::Node *node) -{ - return compileExpression(node); -} - -bool QmlBasicScriptCompiler::tryConstant(QmlJS::AST::Node *node) -{ - if (node->kind == AST::Node::Kind_TrueLiteral || - node->kind == AST::Node::Kind_FalseLiteral) - return true; - - if (node->kind == AST::Node::Kind_NumericLiteral) { - AST::NumericLiteral *lit = static_cast<AST::NumericLiteral *>(node); - - return double(int(lit->value)) == lit->value; - } - - return false; -} - -bool QmlBasicScriptCompiler::parseConstant(QmlJS::AST::Node *node) -{ - ScriptInstruction instr; - - if (node->kind == AST::Node::Kind_NumericLiteral) { - AST::NumericLiteral *lit = static_cast<AST::NumericLiteral *>(node); - instr.type = ScriptInstruction::Int; - instr.integer.value = int(lit->value); - } else { - instr.type = ScriptInstruction::Bool; - instr.boolean.value = node->kind == AST::Node::Kind_TrueLiteral; - } - - bytecode.append(instr); - - return true; -} - -bool QmlBasicScriptCompiler::tryName(QmlJS::AST::Node *node) -{ - return node->kind == AST::Node::Kind_IdentifierExpression || - node->kind == AST::Node::Kind_FieldMemberExpression; -} - -bool QmlBasicScriptCompiler::buildName(QStringList &name, - QmlJS::AST::Node *node) -{ - if (node->kind == AST::Node::Kind_IdentifierExpression) { - name << static_cast<AST::IdentifierExpression*>(node)->name->asString(); - } else if (node->kind == AST::Node::Kind_FieldMemberExpression) { - AST::FieldMemberExpression *expr = - static_cast<AST::FieldMemberExpression *>(node); - - if (!buildName(name, expr->base)) - return false; - - name << expr->name->asString(); - } else { - return false; - } - - return true; -} - -const QMetaObject * -QmlBasicScriptCompiler::fetch(int type, const QMetaObject *mo, int idx) -{ - ScriptInstruction instr; - *((int*)&instr.type) = type; - instr.constant.idx = idx; - QMetaProperty prop = mo->property(idx); - if (prop.isConstant()) - instr.constant.notify = 0; - else - instr.constant.notify = prop.notifySignalIndex(); - instr.constant.type = prop.userType(); - bytecode << instr; - return QmlMetaType::metaObjectForType(prop.userType()); -} - -bool QmlBasicScriptCompiler::parseName(AST::Node *node) -{ - QStringList nameParts; - if (!buildName(nameParts, node)) - return false; - - QmlParser::Object *absType = 0; - const QMetaObject *metaType = 0; - - for (int ii = 0; ii < nameParts.count(); ++ii) { - const QString &name = nameParts.at(ii); - - // We don't handle signal properties - if (name.length() > 2 && name.startsWith(QLatin1String("on")) && - name.at(2).isUpper()) - return false; - - if (ii == 0) { - - if (0) { - // ### - Must test for an attached type name - } else if (ids.contains(name)) { - ScriptInstruction instr; - instr.type = ScriptInstruction::LoadIdObject; - instr.fetch.idx = ids.value(name)->idIndex; - bytecode << instr; - absType = ids.value(name); - } else if(name.at(0).isLower()) { - - QByteArray utf8Name = name.toUtf8(); - const char *cname = utf8Name.constData(); - - int d0Idx = context->metaObject()->indexOfProperty(cname); - int d1Idx = -1; - if (d0Idx == -1) - d1Idx = component->metaObject()->indexOfProperty(cname); - - if (d0Idx != -1) { - metaType = fetch(ScriptInstruction::FetchContextConstant, - context->metaObject(), d0Idx); - } else if(d1Idx != -1) { - metaType = fetch(ScriptInstruction::FetchRootConstant, - component->metaObject(), d1Idx); - } else { - return false; - } - - } else { - return false; - } - } else { - - if (!name.at(0).isLower()) - return false; - - const QMetaObject *mo = 0; - if (absType) - mo = absType->metaObject(); - else if(metaType) - mo = metaType; - else - return false; - - QByteArray utf8Name = name.toUtf8(); - const char *cname = utf8Name.constData(); - int idx = mo->indexOfProperty(cname); - if (idx == -1) - return false; - - if (absType || mo->property(idx).isFinal()) { - absType = 0; metaType = 0; - metaType = fetch(ScriptInstruction::FetchConstant, mo, idx); - } else { - return false; - } - - } - } - - return true; -} - -bool QmlBasicScriptCompiler::compileExpression(QmlJS::AST::Node *node) -{ - if (tryBinaryExpression(node)) - return compileBinaryExpression(node); - else if (tryConstant(node)) - return parseConstant(node); - else if (tryName(node)) - return parseName(node); - else - return false; -} - -bool QmlBasicScriptCompiler::tryBinaryExpression(AST::Node *node) -{ - if (node->kind == AST::Node::Kind_BinaryExpression) { - AST::BinaryExpression *expr = - static_cast<AST::BinaryExpression *>(node); - - if (expr->op == QSOperator::Equal) - return true; - } - return false; -} - -bool QmlBasicScriptCompiler::compileBinaryExpression(AST::Node *node) -{ - if (node->kind == AST::Node::Kind_BinaryExpression) { - AST::BinaryExpression *expr = - static_cast<AST::BinaryExpression *>(node); - - if (!compileExpression(expr->left)) return false; - if (!compileExpression(expr->right)) return false; - - ScriptInstruction instr; - switch (expr->op) { - case QSOperator::Equal: - instr.type = ScriptInstruction::Equals; - break; - default: - return false; - } - - bytecode.append(instr); - return true; - } - return false; -} - -/*! - Run the script in \a context and return the result. - */ -QVariant QmlBasicScript::run(QmlContext *context, QObject *me) -{ - if (!isValid()) - return QVariant(); - - QmlContextPrivate *contextPrivate = context->d_func(); - QmlEnginePrivate *enginePrivate = QmlEnginePrivate::get(context->engine()); - - QStack<QVariant> stack; - - for (int idx = 0; idx < d->instructionCount; ++idx) { - const ScriptInstruction &instr = d->instructions()[idx]; - - switch(instr.type) { - case ScriptInstruction::LoadIdObject: - { - stack.push(QVariant::fromValue(contextPrivate->idValues[instr.fetch.idx].data())); - enginePrivate->capturedProperties << - QmlEnginePrivate::CapturedProperty(context, -1, contextPrivate->notifyIndex + instr.fetch.idx); - } - break; - - case ScriptInstruction::FetchContextConstant: - { - stack.push(fetch_value(me, instr.constant.idx, instr.constant.type)); - if (me && instr.constant.notify != 0) - enginePrivate->capturedProperties << - QmlEnginePrivate::CapturedProperty(me, instr.constant.idx, instr.constant.notify); - } - break; - - case ScriptInstruction::FetchRootConstant: - { - QObject *obj = contextPrivate->defaultObjects.at(0); - - stack.push(fetch_value(obj, instr.constant.idx, instr.constant.type)); - if (obj && instr.constant.notify != 0) - enginePrivate->capturedProperties << - QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify); - } - break; - - case ScriptInstruction::FetchConstant: - { - QVariant o = stack.pop(); - QObject *obj = *(QObject **)o.constData(); - - stack.push(fetch_value(obj, instr.constant.idx, instr.constant.type)); - if (obj && instr.constant.notify != 0) - enginePrivate->capturedProperties << - QmlEnginePrivate::CapturedProperty(obj, instr.constant.idx, instr.constant.notify); - } - break; - - case ScriptInstruction::Int: - stack.push(QVariant(instr.integer.value)); - break; - - case ScriptInstruction::Bool: - stack.push(QVariant(instr.boolean.value)); - break; - - case ScriptInstruction::Equals: - { - QVariant rhs = stack.pop(); - QVariant lhs = stack.pop(); - - stack.push(rhs == lhs); - } - break; - default: - break; - } - } - - if (stack.isEmpty()) - return QVariant(); - else - return stack.top(); -} - -bool QmlBasicScript::isSingleIdFetch() const -{ - if (!isValid()) - return false; - - return d->instructionCount == 1 && - d->instructions()[0].type == ScriptInstruction::LoadIdObject; -} - -int QmlBasicScript::singleIdFetchIndex() const -{ - if (!isSingleIdFetch()) - return -1; - - return d->instructions()[0].fetch.idx; -} - -/*! - Return a pointer to the script's compile data, or null if there is no data. - */ -const char *QmlBasicScript::compileData() const -{ - return (const char *)d; -} - -/*! - Return the size of the script's compile data, or zero if there is no data. - The size will always be a multiple of 4. - */ -unsigned int QmlBasicScript::compileDataSize() const -{ - if (d) - return d->size; - else - return 0; -} - -QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp index 4ec7191..3e29a3c 100644 --- a/src/declarative/qml/qmlbinding.cpp +++ b/src/declarative/qml/qmlbinding.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE QML_DEFINE_NOCREATE_TYPE(QmlBinding); QmlBindingData::QmlBindingData() -: updating(false), enabled(false), nextError(0), prevError(0) +: updating(false), enabled(false) { } @@ -78,37 +78,6 @@ void QmlBindingData::refresh() } } -void QmlBindingData::removeError() -{ - if (!prevError) return; - - if (nextError) nextError->prevError = prevError; - *prevError = nextError; - nextError = 0; - prevError = 0; -} - -bool QmlBindingData::addError() -{ - if (prevError) return false; - - QmlContext *c = context(); - if (!c) return false; - QmlEngine *e = c->engine(); - if (!e) return false; - - QmlEnginePrivate *p = QmlEnginePrivate::get(e); - - if (p->inProgressCreations == 0) return false; // Not in construction - - prevError = &p->erroredBindings; - nextError = p->erroredBindings; - p->erroredBindings = this; - if (nextError) nextError->prevError = &nextError; - - return true; -} - QmlBindingPrivate::QmlBindingPrivate() : QmlExpressionPrivate(new QmlBindingData) { @@ -178,7 +147,11 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags) bool isUndefined = false; QVariant value = this->value(&isUndefined); - if (isUndefined && !data->error.isValid()) { + if (isUndefined && !data->error.isValid() && data->property.isResettable()) { + + data->property.reset(); + + } else if (isUndefined && !data->error.isValid()) { QUrl url = QUrl(data->url); int line = data->line; @@ -190,7 +163,7 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags) data->error.setDescription(QLatin1String("Unable to assign [undefined] to ") + QLatin1String(QMetaType::typeName(data->property.propertyType()))); } else if (!isUndefined && data->property.object() && - !data->property.write(value, flags)) { + !data->property.write(value, flags)) { QUrl url = QUrl(data->url); int line = data->line; @@ -210,7 +183,9 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags) } if (data->error.isValid()) { - if (!data->addError()) + QmlEnginePrivate *p = (data->context() && data->context()->engine())? + QmlEnginePrivate::get(data->context()->engine()):0; + if (!data->addError(p)) qWarning().nospace() << qPrintable(this->error().toString()); } else { data->removeError(); diff --git a/src/declarative/qml/qmlbinding_p.h b/src/declarative/qml/qmlbinding_p.h index 945b659..c6c1935 100644 --- a/src/declarative/qml/qmlbinding_p.h +++ b/src/declarative/qml/qmlbinding_p.h @@ -72,10 +72,6 @@ public: QmlMetaProperty property; virtual void refresh(); - void removeError(); - bool addError(); - QmlBindingData *nextError; - QmlBindingData **prevError; }; class QmlBindingPrivate : public QmlExpressionPrivate diff --git a/src/declarative/qml/qmlbindingoptimizations.cpp b/src/declarative/qml/qmlbindingoptimizations.cpp deleted file mode 100644 index 868440e..0000000 --- a/src/declarative/qml/qmlbindingoptimizations.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmlbindingoptimizations_p.h" - -#include "qmlcontext_p.h" -#include <QtDeclarative/qmlinfo.h> -#include "qmlbindingvme_p.h" - -QT_BEGIN_NAMESPACE - -int QmlOptimizedBindings::methodCount = -1; - -QmlOptimizedBindings::QmlOptimizedBindings(const char *program, QmlContext *context) -: m_program(program) -{ - if (methodCount == -1) - methodCount = QmlOptimizedBindings::staticMetaObject.methodCount(); - - m_config.target = this; - m_config.targetSlot = metaObject()->methodCount(); - - quint32 bindings = 0; - QmlBindingVME::init(m_program, &m_config, &m_signalTable, &bindings); - - m_bindings = new Binding[bindings]; - - QmlAbstractExpression::setContext(context); -} - -QmlOptimizedBindings::~QmlOptimizedBindings() -{ - delete [] m_bindings; -} - -QmlAbstractBinding *QmlOptimizedBindings::configBinding(int index, QObject *target, - QObject *scope, int property) -{ - Binding *rv = m_bindings + index; - - rv->index = index; - rv->property = property; - rv->target = target; - rv->scope = scope; - rv->parent = this; - - addref(); // This is decremented in Binding::destroy() - - return rv; -} - -void QmlOptimizedBindings::Binding::setEnabled(bool e, QmlMetaProperty::WriteFlags flags) -{ - if (e) { - addToObject(target); - update(flags); - } else { - removeFromObject(); - } - - QmlAbstractBinding::setEnabled(e, flags); - - if (enabled != e) { - enabled = e; - - if (e) update(flags); - } -} - -int QmlOptimizedBindings::Binding::propertyIndex() -{ - return property & 0xFFFF; -} - -void QmlOptimizedBindings::Binding::update(QmlMetaProperty::WriteFlags) -{ - parent->run(this); -} - -void QmlOptimizedBindings::Binding::destroy() -{ - enabled = false; - removeFromObject(); - parent->release(); -} - -int QmlOptimizedBindings::qt_metacall(QMetaObject::Call c, int id, void **) -{ - if (c == QMetaObject::InvokeMetaMethod && id >= methodCount) { - id -= methodCount; - - quint32 *reeval = m_signalTable + m_signalTable[id]; - quint32 count = *reeval; - ++reeval; - for (quint32 ii = 0; ii < count; ++ii) { - run(m_bindings + reeval[ii]); - } - } - return -1; -} - -void QmlOptimizedBindings::run(Binding *binding) -{ - if (!binding->enabled) - return; - if (binding->updating) - qWarning("ERROR: Circular binding"); - - QmlContext *context = QmlAbstractExpression::context(); - if (!context) { - qWarning("QmlOptimizedBindings: Attempted to evaluate an expression in an invalid context"); - return; - } - QmlContextPrivate *cp = QmlContextPrivate::get(context); - - if (binding->property & 0xFFFF0000) { - QmlEnginePrivate *ep = QmlEnginePrivate::get(cp->engine); - - QmlValueType *vt = ep->valueTypes[(binding->property >> 16) & 0xFF]; - Q_ASSERT(vt); - vt->read(binding->target, binding->property & 0xFFFF); - - QObject *target = vt; - QmlBindingVME::run(m_program, binding->index, &m_config, cp, - &binding->scope, &target); - - vt->write(binding->target, binding->property & 0xFFFF, - QmlMetaProperty::DontRemoveBinding); - } else { - QmlBindingVME::run(m_program, binding->index, &m_config, cp, - &binding->scope, &binding->target); - } -} - -/* - The QmlBinding_Id optimization handles expressions of the type: - - property: id - - where id is a local context id, and property is an object property. - Coercian between id and property must be checked outside the QmlBinding_Id - - it assumes that they coerce successfully. - - The QmlBinding_Id class avoids any signal slot connections, through the - special "bindings" linked list maintained in the - QmlContextPrivate::ContextGuard instance for each id object. -*/ -QmlBinding_Id::QmlBinding_Id(QObject *object, int propertyIdx, - QmlContext *context, int id) -: m_prev(0), m_next(0), m_object(object), m_propertyIdx(propertyIdx), m_id(id) -{ - QmlAbstractExpression::setContext(context); -} - -QmlBinding_Id::~QmlBinding_Id() -{ - removeFromContext(); -} - -void QmlBinding_Id::setEnabled(bool e, QmlMetaProperty::WriteFlags flags) -{ - if (e) { - addToObject(m_object); - update(flags); - } else { - removeFromObject(); - } - - QmlAbstractBinding::setEnabled(e, flags); -} - -int QmlBinding_Id::propertyIndex() -{ - return m_propertyIdx; -} - -void QmlBinding_Id::update(QmlMetaProperty::WriteFlags flags) -{ - QmlContextPrivate *ctxtPriv = - static_cast<QmlContextPrivate *>(QObjectPrivate::get(context())); - - if (ctxtPriv) { - - if (!m_prev) { - m_next = ctxtPriv->idValues[m_id].bindings; - if (m_next) m_next->m_prev = &m_next; - - m_prev = &ctxtPriv->idValues[m_id].bindings; - ctxtPriv->idValues[m_id].bindings = this; - } - - QObject *o = ctxtPriv->idValues[m_id].data(); - int status = -1; - void *a[] = { &o, 0, &status, &flags }; - QMetaObject::metacall(m_object, QMetaObject::WriteProperty, - m_propertyIdx, a); - } -} - -void QmlBinding_Id::removeFromContext() -{ - if (m_prev) { - *m_prev = m_next; - if (m_next) m_next->m_prev = m_prev; - m_next = 0; - m_prev = 0; - } -} - -void QmlBinding_Id::reset() -{ - removeFromContext(); - - QObject *o = 0; - int status = -1; - QmlMetaProperty::WriteFlags flags = QmlMetaProperty::DontRemoveBinding; - void *a[] = { &o, 0, &status, &flags }; - QMetaObject::metacall(m_object, QMetaObject::WriteProperty, - m_propertyIdx, a); -} - -QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlbindingoptimizations_p.h b/src/declarative/qml/qmlbindingoptimizations_p.h deleted file mode 100644 index feb753e..0000000 --- a/src/declarative/qml/qmlbindingoptimizations_p.h +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLBINDINGOPTIMIZATIONS_P_H -#define QMLBINDINGOPTIMIZATIONS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qmlexpression_p.h" -#include "qmlbinding.h" -#include "qmlbasicscript_p.h" -#include "qmlbindingvme_p.h" - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -class QmlOptimizedBindings : public QObject, public QmlAbstractExpression, public QmlRefCount -{ -public: - QmlOptimizedBindings(const char *program, QmlContext *context); - virtual ~QmlOptimizedBindings(); - QmlAbstractBinding *configBinding(int index, QObject *target, QObject *scope, int property); - -protected: - int qt_metacall(QMetaObject::Call, int, void **); - -private: - struct Binding : public QmlAbstractBinding { - Binding() : enabled(false), updating(0), property(0), - scope(0), target(0), parent(0) {} - - // Inherited from QmlAbstractBinding - virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags); - virtual int propertyIndex(); - virtual void update(QmlMetaProperty::WriteFlags flags); - virtual void destroy(); - - int index:30; - bool enabled:1; - bool updating:1; - int property; - QObject *scope; - QObject *target; - - QmlOptimizedBindings *parent; - }; - void run(Binding *); - - QmlBindingVME::Config m_config; - const char *m_program; - Binding *m_bindings; - quint32 *m_signalTable; - - static int methodCount; -}; - -class QmlBinding_Id : public QmlAbstractExpression, - public QmlAbstractBinding -{ -public: - QmlBinding_Id(QObject *object, int propertyIdx, - QmlContext *context, int id); - virtual ~QmlBinding_Id(); - - // Inherited from QmlAbstractBinding - virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags); - virtual int propertyIndex(); - virtual void update(QmlMetaProperty::WriteFlags flags); - - void reset(); - -private: - void removeFromContext(); - - QmlBinding_Id **m_prev; - QmlBinding_Id *m_next; - - QObject *m_object; - int m_propertyIdx; - int m_id; -}; - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif // QMLBINDINGOPTIMIZATIONS_P_H - diff --git a/src/declarative/qml/qmlbindingvme.cpp b/src/declarative/qml/qmlcompiledbindings.cpp index 16b0a21..d09f7eb 100644 --- a/src/declarative/qml/qmlbindingvme.cpp +++ b/src/declarative/qml/qmlcompiledbindings.cpp @@ -39,11 +39,15 @@ ** ****************************************************************************/ -#include "qmlbindingvme_p.h" +#include "qmlcompiledbindings_p.h" + +#include <QtDeclarative/qmlinfo.h> #include <private/qmlcontext_p.h> #include <private/qmljsast_p.h> #include <private/qmljsengine_p.h> +#include <private/qmlexpression_p.h> #include <QtCore/qdebug.h> +#include <QtCore/qnumeric.h> #include <private/qmlgraphicsanchors_p_p.h> QT_BEGIN_NAMESPACE @@ -53,32 +57,293 @@ using namespace QmlJS; namespace { // Supported types: int, qreal, QString (needs constr/destr), QObject*, bool struct Register { - void setQObject(QObject *o) { *((QObject **)data) = o; } - QObject *getQObject() { return *((QObject **)data); } + void setUndefined() { type = 0; } + void setUnknownButDefined() { type = -1; } + void setNaN() { setqreal(qSNaN()); } + bool isUndefined() const { return type == 0; } + + void setQObject(QObject *o) { *((QObject **)data) = o; type = QMetaType::QObjectStar; } + QObject *getQObject() const { return *((QObject **)data); } - void setqreal(qreal v) { *((qreal *)data) = v; } - qreal getqreal() { return *((qreal *)data); } + void setqreal(qreal v) { *((qreal *)data) = v; type = QMetaType::QReal; } + qreal getqreal() const { return *((qreal *)data); } - void setint(int v) { *((int *)data) = v; } - int getint() { return *((int *)data); } + void setint(int v) { *((int *)data) = v; type = QMetaType::Int; } + int getint() const { return *((int *)data); } - void setbool(bool v) { *((bool *)data) = v; } - bool getbool() { return *((bool *)data); } + void setbool(bool v) { *((bool *)data) = v; type = QMetaType::Bool; } + bool getbool() const { return *((bool *)data); } QVariant *getvariantptr() { return (QVariant *)typeDataPtr(); } QString *getstringptr() { return (QString *)typeDataPtr(); } QUrl *geturlptr() { return (QUrl *)typeDataPtr(); } + const QVariant *getvariantptr() const { return (QVariant *)typeDataPtr(); } + const QString *getstringptr() const { return (QString *)typeDataPtr(); } + const QUrl *geturlptr() const { return (QUrl *)typeDataPtr(); } void *typeDataPtr() { return (void *)&data; } void *typeMemory() { return (void *)data; } + const void *typeDataPtr() const { return (void *)&data; } + const void *typeMemory() const { return (void *)data; } - int gettype() { return type; } + int gettype() const { return type; } void settype(int t) { type = t; } int type; // Optional type void *data[2]; // Object stored here }; +} + +class QmlCompiledBindingsPrivate : public QObjectPrivate +{ + Q_DECLARE_PUBLIC(QmlCompiledBindings) + +public: + QmlCompiledBindingsPrivate(); + virtual ~QmlCompiledBindingsPrivate(); + + struct Binding : public QmlAbstractBinding, public QmlDelayedError { + Binding() : enabled(false), updating(0), property(0), + scope(0), target(0), parent(0) {} + + // Inherited from QmlAbstractBinding + virtual void setEnabled(bool, QmlMetaProperty::WriteFlags flags); + virtual int propertyIndex(); + virtual void update(QmlMetaProperty::WriteFlags flags); + virtual void destroy(); + + int index:30; + bool enabled:1; + bool updating:1; + int property; + QObject *scope; + QObject *target; + + QmlCompiledBindingsPrivate *parent; + }; + + struct Subscription { + struct Signal { + QmlGuard<QObject> source; + int notifyIndex; + }; + + enum { InvalidType, SignalType, IdType } type; + inline Subscription(); + inline ~Subscription(); + bool isSignal() const { return type == SignalType; } + bool isId() const { return type == IdType; } + inline Signal *signal(); + inline QmlContextPrivate::IdNotifier *id(); + union { + char signalData[sizeof(Signal)]; + char idData[sizeof(QmlContextPrivate::IdNotifier)]; + }; + }; + Subscription *subscriptions; + QScriptDeclarativeClass::PersistentIdentifier *identifiers; + + void run(Binding *); + + const char *programData; + Binding *m_bindings; + quint32 *m_signalTable; + + static int methodCount; + + void init(); + void run(int instr, QmlContextPrivate *context, + QmlDelayedError *error, QObject *scope, QObject *output); + + + inline void unsubscribe(int subIndex); + inline void subscribeId(QmlContextPrivate *p, int idIndex, int subIndex); + inline void subscribe(QObject *o, int notifyIndex, int subIndex); + + QmlPropertyCache::Data *findproperty(QObject *obj, + const QScriptDeclarativeClass::Identifier &name, + QmlEnginePrivate *enginePriv, + QmlPropertyCache::Data &local); + bool findproperty(QObject *obj, + Register *output, + QmlEnginePrivate *enginePriv, + int subIdx, + const QScriptDeclarativeClass::Identifier &name, + bool isTerminal); + void findgeneric(Register *output, // value output + int subIdx, // Subscription index in config + QmlContextPrivate *context, // Context to search in + const QScriptDeclarativeClass::Identifier &name, + bool isTerminal); +}; + +QmlCompiledBindingsPrivate::QmlCompiledBindingsPrivate() +: subscriptions(0), identifiers(0) +{ +} + +QmlCompiledBindingsPrivate::~QmlCompiledBindingsPrivate() +{ + delete [] subscriptions; subscriptions = 0; + delete [] identifiers; identifiers = 0; +} + +QmlCompiledBindingsPrivate::Subscription::Subscription() +: type(InvalidType) +{ +} + +QmlCompiledBindingsPrivate::Subscription::~Subscription() +{ + if (type == SignalType) ((Signal *)signalData)->~Signal(); + else if (type == IdType) ((QmlContextPrivate::IdNotifier *)idData)->~IdNotifier(); +} + + +int QmlCompiledBindingsPrivate::methodCount = -1; +QmlCompiledBindings::QmlCompiledBindings(const char *program, QmlContext *context) +: QObject(*(new QmlCompiledBindingsPrivate)) +{ + Q_D(QmlCompiledBindings); + + if (d->methodCount == -1) + d->methodCount = QmlCompiledBindings::staticMetaObject.methodCount(); + + d->programData = program; + + d->init(); + + QmlAbstractExpression::setContext(context); +} + +QmlCompiledBindings::~QmlCompiledBindings() +{ + Q_D(QmlCompiledBindings); + + delete [] d->m_bindings; +} + +QmlAbstractBinding *QmlCompiledBindings::configBinding(int index, QObject *target, + QObject *scope, int property) +{ + Q_D(QmlCompiledBindings); + + QmlCompiledBindingsPrivate::Binding *rv = d->m_bindings + index; + + rv->index = index; + rv->property = property; + rv->target = target; + rv->scope = scope; + rv->parent = d; + + addref(); // This is decremented in Binding::destroy() + + return rv; +} + +void QmlCompiledBindingsPrivate::Binding::setEnabled(bool e, QmlMetaProperty::WriteFlags flags) +{ + if (e) { + addToObject(target); + update(flags); + } else { + removeFromObject(); + } + + QmlAbstractBinding::setEnabled(e, flags); + + if (enabled != e) { + enabled = e; + + if (e) update(flags); + } +} + +int QmlCompiledBindingsPrivate::Binding::propertyIndex() +{ + return property & 0xFFFF; +} + +void QmlCompiledBindingsPrivate::Binding::update(QmlMetaProperty::WriteFlags) +{ + parent->run(this); +} + +void QmlCompiledBindingsPrivate::Binding::destroy() +{ + enabled = false; + removeFromObject(); + parent->q_func()->release(); +} + +int QmlCompiledBindings::qt_metacall(QMetaObject::Call c, int id, void **) +{ + Q_D(QmlCompiledBindings); + + if (c == QMetaObject::InvokeMetaMethod && id >= d->methodCount) { + id -= d->methodCount; + + quint32 *reeval = d->m_signalTable + d->m_signalTable[id]; + quint32 count = *reeval; + ++reeval; + for (quint32 ii = 0; ii < count; ++ii) { + d->run(d->m_bindings + reeval[ii]); + } + } + return -1; +} + +void QmlCompiledBindingsPrivate::run(Binding *binding) +{ + Q_Q(QmlCompiledBindings); + + if (!binding->enabled) + return; + if (binding->updating) + qWarning("ERROR: Circular binding"); + + QmlContext *context = q->QmlAbstractExpression::context(); + if (!context) { + qWarning("QmlCompiledBindings: Attempted to evaluate an expression in an invalid context"); + return; + } + QmlContextPrivate *cp = QmlContextPrivate::get(context); + + if (binding->property & 0xFFFF0000) { + QmlEnginePrivate *ep = QmlEnginePrivate::get(cp->engine); + + QmlValueType *vt = ep->valueTypes[(binding->property >> 16) & 0xFF]; + Q_ASSERT(vt); + vt->read(binding->target, binding->property & 0xFFFF); + + QObject *target = vt; + run(binding->index, cp, binding, binding->scope, target); + + vt->write(binding->target, binding->property & 0xFFFF, + QmlMetaProperty::DontRemoveBinding); + } else { + run(binding->index, cp, binding, binding->scope, binding->target); + } +} + +QmlCompiledBindingsPrivate::Subscription::Signal *QmlCompiledBindingsPrivate::Subscription::signal() +{ + if (type == IdType) ((QmlContextPrivate::IdNotifier *)idData)->~IdNotifier(); + if (type != SignalType) new (signalData) Signal; + type = SignalType; + return (Signal *)signalData; +} + +QmlContextPrivate::IdNotifier *QmlCompiledBindingsPrivate::Subscription::id() +{ + if (type == SignalType) ((Signal *)signalData)->~Signal(); + if (type != IdType) new (idData) QmlContextPrivate::IdNotifier; + type = IdType; + return (QmlContextPrivate::IdNotifier *)idData; +} + +namespace { // This structure is exactly 8-bytes in size struct Instr { enum { @@ -171,21 +436,21 @@ struct Instr { quint8 type; qint8 output; qint8 reg; - quint8 packing[1]; + quint8 exceptionId; quint32 index; } attached; struct { quint8 type; qint8 output; qint8 reg; - quint8 packing[1]; + quint8 exceptionId; quint32 index; } store; struct { quint8 type; qint8 output; qint8 objectReg; - quint8 packing[1]; + quint8 exceptionId; quint32 index; } fetch; struct { @@ -246,7 +511,7 @@ struct Instr { quint8 type; qint8 reg; qint8 src; - quint8 packing[1]; + quint8 exceptionId; quint16 name; quint16 subscribeIndex; } find; @@ -268,6 +533,7 @@ struct Program { quint32 bindings; quint32 dataLength; quint32 signalTableOffset; + quint32 exceptionDataOffset; quint16 subscriptions; quint16 identifiers; quint16 instructionCount; @@ -337,8 +603,8 @@ struct QmlBindingCompilerPrivate bool tryMethod(QmlJS::AST::Node *); bool parseMethod(QmlJS::AST::Node *, Result &); - bool buildName(QStringList &, QmlJS::AST::Node *); - bool fetch(Result &type, const QMetaObject *, int reg, int idx, const QStringList &); + bool buildName(QStringList &, QmlJS::AST::Node *, QList<QmlJS::AST::ExpressionNode *> *nodes = 0); + bool fetch(Result &type, const QMetaObject *, int reg, int idx, const QStringList &, QmlJS::AST::ExpressionNode *); quint32 registers; QHash<int, QPair<int, int> > registerCleanups; @@ -355,6 +621,9 @@ struct QmlBindingCompilerPrivate int subscriptionIndex(const QStringList &); bool subscriptionNeutral(const QSet<QString> &base, const QSet<QString> &lhs, const QSet<QString> &rhs); + quint8 exceptionId(QmlJS::AST::ExpressionNode *); + QVector<quint64> exceptions; + QSet<int> usedSubscriptionIds; QSet<QString> subscriptionSet; QHash<QString, int> subscriptionIds; @@ -368,6 +637,7 @@ struct QmlBindingCompilerPrivate QVector<Instr> bytecode; QByteArray data; QHash<QString, int> subscriptionIds; + QVector<quint64> exceptions; QHash<QString, QPair<int, int> > registeredStrings; @@ -375,35 +645,173 @@ struct QmlBindingCompilerPrivate } committed; QByteArray buildSignalTable() const; + QByteArray buildExceptionData() const; }; -inline void subscribe(QObject *o, int notifyIndex, - int subIndex, QmlBindingVME::Config *config) +void QmlCompiledBindingsPrivate::unsubscribe(int subIndex) +{ + Q_Q(QmlCompiledBindings); + + QmlCompiledBindingsPrivate::Subscription *sub = (subscriptions + subIndex); + if (sub->isSignal()) { + QmlCompiledBindingsPrivate::Subscription::Signal *s = sub->signal(); + if (s->source) +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) + QMetaObject::disconnectOne(s->source, s->notifyIndex, + q, methodCount + subIndex); +#else + // QTBUG-6781 + QMetaObject::disconnect(s->source, s->notifyIndex, + q, methodCount + subIndex); +#endif + } else if (sub->isId()) { + sub->id()->clear(); + } +} + +void QmlCompiledBindingsPrivate::subscribeId(QmlContextPrivate *p, int idIndex, int subIndex) { - QmlBindingVME::Config::Subscription *s = config->subscriptions + subIndex; + Q_Q(QmlCompiledBindings); + + unsubscribe(subIndex); + + if (p->idValues[idIndex]) { + QmlCompiledBindingsPrivate::Subscription *sub = (subscriptions + subIndex); + QmlContextPrivate::IdNotifier *i = sub->id(); + + i->next = p->idValues[idIndex].bindings; + i->prev = &p->idValues[idIndex].bindings; + p->idValues[idIndex].bindings = i; + if (i->next) i->next->prev = &i->next; + + i->target = q; + i->methodIndex = methodCount + subIndex; + } +} + +void QmlCompiledBindingsPrivate::subscribe(QObject *o, int notifyIndex, int subIndex) +{ + Q_Q(QmlCompiledBindings); + + QmlCompiledBindingsPrivate::Subscription *sub = (subscriptions + subIndex); + + if (sub->isId()) + unsubscribe(subIndex); + + QmlCompiledBindingsPrivate::Subscription::Signal *s = sub->signal(); if (o != s->source || notifyIndex != s->notifyIndex) { if (s->source) +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) QMetaObject::disconnectOne(s->source, s->notifyIndex, - config->target, config->targetSlot + subIndex); + q, methodCount + subIndex); +#else + // QTBUG-6781 + QMetaObject::disconnect(s->source, s->notifyIndex, + q, methodCount + subIndex); +#endif s->source = o; s->notifyIndex = notifyIndex; if (s->source && s->notifyIndex != -1) - QMetaObject::connect(s->source, s->notifyIndex, config->target, - config->targetSlot + subIndex, Qt::DirectConnection); + QMetaObject::connect(s->source, s->notifyIndex, q, + methodCount + subIndex, Qt::DirectConnection); } } +// Conversion functions - these MUST match the QtScript expression path +inline static qreal toReal(Register *reg, int type, bool *ok = 0) +{ + if (ok) *ok = true; + + if (type == QMetaType::QReal) { + return reg->getqreal(); + } else if (type == qMetaTypeId<QVariant>()) { + return reg->getvariantptr()->toReal(); + } else { + if (ok) *ok = false; + return 0; + } +} + +inline static QString toString(Register *reg, int type, bool *ok = 0) +{ + if (ok) *ok = true; + + if (type == QMetaType::QReal) { + return QString::number(reg->getqreal()); + } else if (type == QMetaType::Int) { + return QString::number(reg->getint()); + } else if (type == qMetaTypeId<QVariant>()) { + return reg->getvariantptr()->toString(); + } else if (type == QMetaType::QString) { + return *reg->getstringptr(); + } else { + if (ok) *ok = false; + return QString(); + } +} + +inline static bool toBool(Register *reg, int type, bool *ok = 0) +{ + if (ok) *ok = true; + + if (type == QMetaType::Bool) { + return reg->getbool(); + } else if (type == qMetaTypeId<QVariant>()) { + return reg->getvariantptr()->toBool(); + } else { + if (ok) *ok = false; + return false; + } +} + +inline static QUrl toUrl(Register *reg, int type, QmlContextPrivate *context, bool *ok = 0) +{ + if (ok) *ok = true; + + QUrl base; + if (type == qMetaTypeId<QVariant>()) { + QVariant *var = reg->getvariantptr(); + int vt = var->type(); + if (vt == QVariant::Url) { + base = var->toUrl(); + } else if (vt == QVariant::ByteArray) { + base = QUrl(QString::fromUtf8(var->toByteArray())); + } else if (vt == QVariant::String) { + base = QUrl(var->toString()); + } else { + if (ok) *ok = false; + return QUrl(); + } + } else if (type == QMetaType::QString) { + base = QUrl(*reg->getstringptr()); + } else { + if (ok) *ok = false; + return QUrl(); + } + + if (!base.isEmpty() && base.isRelative()) + return context->url.resolved(base); + else + return base; +} + static QObject *variantToQObject(const QVariant &value, bool *ok) { - *ok = false; - Q_UNUSED(value); - return 0; + if (ok) *ok = true; + + if (value.userType() == QMetaType::QObjectStar) { + return qvariant_cast<QObject*>(value); + } else { + if (ok) *ok = false; + return 0; + } } -static QmlPropertyCache::Data *findproperty(QObject *obj, - const QScriptDeclarativeClass::Identifier &name, - QmlEnginePrivate *enginePriv, - QmlPropertyCache::Data &local) +QmlPropertyCache::Data * +QmlCompiledBindingsPrivate::findproperty(QObject *obj, + const QScriptDeclarativeClass::Identifier &name, + QmlEnginePrivate *enginePriv, + QmlPropertyCache::Data &local) { QmlPropertyCache *cache = 0; QmlDeclarativeData *ddata = QmlDeclarativeData::get(obj); @@ -429,21 +837,22 @@ static QmlPropertyCache::Data *findproperty(QObject *obj, return property; } -static bool findproperty(QObject *obj, Register *output, - QmlEnginePrivate *enginePriv, - QmlBindingVME::Config *config, int subIdx, - const QScriptDeclarativeClass::Identifier &name, - bool isTerminal) +bool QmlCompiledBindingsPrivate::findproperty(QObject *obj, Register *output, + QmlEnginePrivate *enginePriv, + int subIdx, const QScriptDeclarativeClass::Identifier &name, + bool isTerminal) { - if (!obj) + if (!obj) { + output->setUndefined(); return false; + } QmlPropertyCache::Data local; QmlPropertyCache::Data *property = findproperty(obj, name, enginePriv, local); if (property) { if (subIdx != -1) - subscribe(obj, property->notifyIndex, subIdx, config); + subscribe(obj, property->notifyIndex, subIdx); if (property->flags & QmlPropertyCache::Data::IsQObjectDerived) { void *args[] = { output->typeDataPtr(), 0 }; @@ -460,15 +869,16 @@ static bool findproperty(QObject *obj, Register *output, } else { bool ok; output->setQObject(variantToQObject(v, &ok)); - if (!ok) return false; - output->settype(QMetaType::QObjectStar); + if (!ok) + output->setUndefined(); + else + output->settype(QMetaType::QObjectStar); } } else { - if (!isTerminal) - return false; - - if (property->propType == QMetaType::QReal) { + if (!isTerminal) { + output->setUndefined(); + } else if (property->propType == QMetaType::QReal) { void *args[] = { output->typeDataPtr(), 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, property->coreIndex, args); output->settype(QMetaType::QReal); @@ -490,32 +900,20 @@ static bool findproperty(QObject *obj, Register *output, QVariant(obj->metaObject()->property(property->coreIndex).read(obj)); output->settype(qMetaTypeId<QVariant>()); } - } return true; } else { + output->setUndefined(); return false; } } -static bool findproperty(Register *input, - Register *output, - QmlEnginePrivate *enginePriv, - QmlBindingVME::Config *config, int subIdx, - const QScriptDeclarativeClass::Identifier &name, - bool isTerminal) -{ - return findproperty(input->getQObject(), output, enginePriv, - config, subIdx, name, isTerminal); -} - -static bool findgeneric(Register *output, // value output - QmlBindingVME::Config *config, - int subIdx, // Subscription index in config - QmlContextPrivate *context, // Context to search in - const QScriptDeclarativeClass::Identifier &name, - bool isTerminal) +void QmlCompiledBindingsPrivate::findgeneric(Register *output, + int subIdx, + QmlContextPrivate *context, + const QScriptDeclarativeClass::Identifier &name, + bool isTerminal) { QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(context->engine); @@ -527,8 +925,7 @@ static bool findgeneric(Register *output, // val if (contextPropertyIndex != -1) { if (subIdx != -1) - subscribe(QmlContextPrivate::get(context), contextPropertyIndex + context->notifyIndex, - subIdx, config); + subscribe(QmlContextPrivate::get(context), contextPropertyIndex + context->notifyIndex, subIdx); if (contextPropertyIndex < context->idValueCount) { output->setQObject(context->idValues[contextPropertyIndex]); @@ -541,26 +938,26 @@ static bool findgeneric(Register *output, // val } else { bool ok; output->setQObject(variantToQObject(value, &ok)); - if (!ok) return false; - output->settype(QMetaType::QObjectStar); + if (!ok) { output->setUndefined(); } + else { output->settype(QMetaType::QObjectStar); } + return; } } - return true; + return; } for (int ii = 0; ii < context->scripts.count(); ++ii) { QScriptValue function = QScriptDeclarativeClass::function(context->scripts.at(ii), name); if (function.isValid()) { qFatal("Binding optimizer resolved name to QScript method"); - return false; } } if (QObject *root = context->defaultObjects.isEmpty()?0:context->defaultObjects.first()) { - if (findproperty(root, output, enginePriv, config, subIdx, name, isTerminal)) - return true; + if (findproperty(root, output, enginePriv, subIdx, name, isTerminal)) + return; } @@ -571,106 +968,48 @@ static bool findgeneric(Register *output, // val } } - return false; -} - - -// Conversion functions - these MUST match the QtScript expression path -inline static qreal toReal(Register *reg, int type, bool *ok = 0) -{ - if (ok) *ok = true; - - if (type == QMetaType::QReal) { - return reg->getqreal(); - } else if (type == qMetaTypeId<QVariant>()) { - return reg->getvariantptr()->toReal(); - } else { - if (ok) *ok = false; - return 0; - } + output->setUndefined(); } -inline static QString toString(Register *reg, int type, bool *ok = 0) +void QmlCompiledBindingsPrivate::init() { - if (ok) *ok = true; - - if (type == QMetaType::QReal) { - return QString::number(reg->getqreal()); - } else if (type == qMetaTypeId<QVariant>()) { - return reg->getvariantptr()->toString(); - } else if (type == QMetaType::QString) { - return *reg->getstringptr(); - } else { - if (ok) *ok = false; - return QString(); - } -} - -inline static bool toBool(Register *reg, int type, bool *ok = 0) -{ - if (ok) *ok = true; + Program *program = (Program *)programData; + if (program->subscriptions) + subscriptions = new QmlCompiledBindingsPrivate::Subscription[program->subscriptions]; + if (program->identifiers) + identifiers = new QScriptDeclarativeClass::PersistentIdentifier[program->identifiers]; - if (type == QMetaType::Bool) { - return reg->getbool(); - } else if (type == qMetaTypeId<QVariant>()) { - return reg->getvariantptr()->toBool(); - } else { - if (ok) *ok = false; - return false; - } + m_signalTable = (quint32 *)(program->data() + program->signalTableOffset); + m_bindings = new QmlCompiledBindingsPrivate::Binding[program->bindings]; } -inline static QUrl toUrl(Register *reg, int type, QmlContextPrivate *context, bool *ok = 0) +static void throwException(int id, QmlDelayedError *error, + Program *program, QmlContextPrivate *context, + const QString &description = QString()) { - if (ok) *ok = true; - - QUrl base; - if (type == qMetaTypeId<QVariant>()) { - QVariant *var = reg->getvariantptr(); - int vt = var->type(); - if (vt == QVariant::Url) { - base = var->toUrl(); - } else if (vt == QVariant::ByteArray) { - base = QUrl(QString::fromUtf8(var->toByteArray())); - } else if (vt == QVariant::String) { - base = QUrl(var->toString()); - } else { - if (ok) *ok = false; - return QUrl(); - } - } else if (type == QMetaType::QString) { - base = QUrl(*reg->getstringptr()); + error->error.setUrl(context->url); + if (description.isEmpty()) + error->error.setDescription(QLatin1String("TypeError: Result of expression is not an object")); + else + error->error.setDescription(description); + if (id != 0xFF) { + quint64 e = *((quint64 *)(program->data() + program->exceptionDataOffset) + id); + error->error.setLine((e >> 32) & 0xFFFFFFFF); + error->error.setColumn(e & 0xFFFFFFFF); } else { - if (ok) *ok = false; - return QUrl(); + error->error.setLine(-1); + error->error.setColumn(-1); } - - if (!base.isEmpty() && base.isRelative()) - return context->url.resolved(base); - else - return base; + if (!context->engine || !error->addError(QmlEnginePrivate::get(context->engine))) + qWarning() << error->error; } -/*! -Returns the signal/binding table. -*/ -void QmlBindingVME::init(const char *programData, Config *config, - quint32 **sigTable, quint32 *bindingCount) +void QmlCompiledBindingsPrivate::run(int instrIndex, + QmlContextPrivate *context, QmlDelayedError *error, + QObject *scope, QObject *output) { - Program *program = (Program *)programData; - if (program->subscriptions) - config->subscriptions = new Config::Subscription[program->subscriptions]; - if (program->identifiers) - config->identifiers = new QScriptDeclarativeClass::PersistentIdentifier[program->identifiers]; + error->removeError(); - *sigTable = (quint32 *)(program->data() + program->signalTableOffset); - *bindingCount = program->bindings; -} - -void QmlBindingVME::run(const char *programData, int instrIndex, - Config *config, QmlContextPrivate *context, - QObject **scopes, QObject **outputs) -{ Register registers[32]; int storeFlags = 0; @@ -687,18 +1026,16 @@ void QmlBindingVME::run(const char *programData, int instrIndex, break; case Instr::SubscribeId: - case Instr::Subscribe: - { - QObject *o = registers[instr->subscribe.reg].getQObject(); - int notifyIndex = instr->subscribe.index; - - if (instr->common.type == Instr::SubscribeId) { - o = QmlContextPrivate::get(context); - notifyIndex += context->notifyIndex; - } + subscribeId(context, instr->subscribe.index, instr->subscribe.offset); + break; - subscribe(o, instr->subscribe.index, instr->subscribe.offset, config); - } + case Instr::Subscribe: + { + QObject *o = 0; + const Register &object = registers[instr->subscribe.reg]; + if (!object.isUndefined()) o = object.getQObject(); + subscribe(o, instr->subscribe.index, instr->subscribe.offset); + } break; case Instr::LoadId: @@ -706,7 +1043,7 @@ void QmlBindingVME::run(const char *programData, int instrIndex, break; case Instr::LoadScope: - registers[instr->load.reg].setQObject(scopes[instr->load.index]); + registers[instr->load.reg].setQObject(scope); break; case Instr::LoadRoot: @@ -714,20 +1051,44 @@ void QmlBindingVME::run(const char *programData, int instrIndex, break; case Instr::LoadAttached: - { - QObject *o = qmlAttachedPropertiesObjectById(instr->attached.index, - registers[instr->attached.reg].getQObject(), - true); - registers[instr->attached.output].setQObject(o); + { + const Register &input = registers[instr->attached.reg]; + Register &output = registers[instr->attached.output]; + if (input.isUndefined()) { + throwException(instr->attached.exceptionId, error, program, context); + return; } + + QObject *object = registers[instr->attached.reg].getQObject(); + if (!object) { + output.setUndefined(); + } else { + QObject *attached = + qmlAttachedPropertiesObjectById(instr->attached.index, + registers[instr->attached.reg].getQObject(), + true); + Q_ASSERT(attached); + output.setQObject(attached); + } + } break; case Instr::ConvertIntToReal: - registers[instr->unaryop.output].setqreal(qreal(registers[instr->unaryop.src].getint())); + { + const Register &input = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + if (input.isUndefined()) output.setUndefined(); + else output.setqreal(qreal(input.getint())); + } break; case Instr::ConvertRealToInt: - registers[instr->unaryop.output].setint(int(registers[instr->unaryop.src].getqreal())); + { + const Register &input = registers[instr->unaryop.src]; + Register &output = registers[instr->unaryop.output]; + if (input.isUndefined()) output.setUndefined(); + else output.setint(int(input.getqreal())); + } break; case Instr::Real: @@ -743,74 +1104,160 @@ void QmlBindingVME::run(const char *programData, int instrIndex, break; case Instr::String: - new (registers[instr->bool_value.reg].getstringptr()) + { + Register &output = registers[instr->string_value.reg]; + new (output.getstringptr()) QString((QChar *)(data + instr->string_value.offset), instr->string_value.length); + output.settype(QMetaType::QString); + } break; case Instr::AddReal: - registers[instr->binaryop.output].setqreal(registers[instr->binaryop.src1].getqreal() + - registers[instr->binaryop.src2].getqreal()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setNaN(); + else output.setqreal(lhs.getqreal() + rhs.getqreal()); + } break; case Instr::AddInt: - registers[instr->binaryop.output].setint(registers[instr->binaryop.src1].getint() + - registers[instr->binaryop.src2].getint()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setNaN(); + else output.setint(lhs.getint() + rhs.getint()); + } break; case Instr::AddString: - new (registers[instr->binaryop.output].getstringptr()) - QString(*registers[instr->binaryop.src1].getstringptr() + - *registers[instr->binaryop.src2].getstringptr()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() && rhs.isUndefined()) { output.setNaN(); } + else { + if (lhs.isUndefined()) + new (output.getstringptr()) + QString(QLatin1String("undefined") + *registers[instr->binaryop.src2].getstringptr()); + else if (rhs.isUndefined()) + new (output.getstringptr()) + QString(*registers[instr->binaryop.src1].getstringptr() + QLatin1String("undefined")); + else + new (output.getstringptr()) + QString(*registers[instr->binaryop.src1].getstringptr() + + *registers[instr->binaryop.src2].getstringptr()); + output.settype(QMetaType::QString); + } + } break; case Instr::MinusReal: - registers[instr->binaryop.output].setqreal(registers[instr->binaryop.src1].getqreal() - - registers[instr->binaryop.src2].getqreal()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setNaN(); + else output.setqreal(lhs.getqreal() - rhs.getqreal()); + } break; case Instr::MinusInt: - registers[instr->binaryop.output].setint(registers[instr->binaryop.src1].getint() - - registers[instr->binaryop.src2].getint()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setNaN(); + else output.setint(lhs.getint() - rhs.getint()); + } break; case Instr::CompareReal: - registers[instr->binaryop.output].setbool(registers[instr->binaryop.src1].getqreal() == - registers[instr->binaryop.src2].getqreal()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setbool(lhs.isUndefined() == rhs.isUndefined()); + else output.setbool(lhs.getqreal() == rhs.getqreal()); + } break; case Instr::CompareString: - registers[instr->binaryop.output].setbool(*registers[instr->binaryop.src1].getstringptr() == - *registers[instr->binaryop.src2].getstringptr()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setbool(lhs.isUndefined() == rhs.isUndefined()); + else output.setbool(*lhs.getstringptr() == *rhs.getstringptr()); + } break; case Instr::NotCompareReal: - registers[instr->binaryop.output].setbool(registers[instr->binaryop.src1].getqreal() != - registers[instr->binaryop.src2].getqreal()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setbool(lhs.isUndefined() != rhs.isUndefined()); + else output.setbool(lhs.getqreal() != rhs.getqreal()); + } break; case Instr::NotCompareString: - registers[instr->binaryop.output].setbool(*registers[instr->binaryop.src1].getstringptr() != - *registers[instr->binaryop.src2].getstringptr()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setbool(lhs.isUndefined() != rhs.isUndefined()); + else output.setbool(*lhs.getstringptr() != *rhs.getstringptr()); + } break; case Instr::GreaterThanReal: - registers[instr->binaryop.output].setbool(registers[instr->binaryop.src1].getqreal() > - registers[instr->binaryop.src2].getqreal()); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setbool(false); + else output.setbool(lhs.getqreal() > rhs.getqreal()); + } break; + case Instr::MaxReal: - registers[instr->binaryop.output].setqreal(qMax(registers[instr->binaryop.src1].getqreal(), - registers[instr->binaryop.src2].getqreal())); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setNaN(); + else output.setqreal(qMax(lhs.getqreal(), rhs.getqreal())); + } break; + case Instr::MinReal: - registers[instr->binaryop.output].setqreal(qMin(registers[instr->binaryop.src1].getqreal(), - registers[instr->binaryop.src2].getqreal())); + { + const Register &lhs = registers[instr->binaryop.src1]; + const Register &rhs = registers[instr->binaryop.src2]; + Register &output = registers[instr->binaryop.output]; + if (lhs.isUndefined() || rhs.isUndefined()) output.setNaN(); + else output.setqreal(qMin(lhs.getqreal(), rhs.getqreal())); + } break; + case Instr::NewString: - new (registers[instr->construct.reg].typeMemory()) QString; + { + Register &output = registers[instr->construct.reg]; + new (output.getstringptr()) QString; + output.settype(QMetaType::QString); + } break; case Instr::NewUrl: - new (registers[instr->construct.reg].typeMemory()) QUrl; + { + Register &output = registers[instr->construct.reg]; + new (output.geturlptr()) QUrl; + output.settype(QMetaType::QUrl); + } break; case Instr::CleanupString: @@ -822,25 +1269,39 @@ void QmlBindingVME::run(const char *programData, int instrIndex, break; case Instr::Fetch: - { - QObject *object = registers[instr->fetch.objectReg].getQObject(); - if (!object) { - qWarning() << "ERROR - Fetch"; - return; - } - void *argv[] = { registers[instr->fetch.output].typeDataPtr(), 0 }; + { + const Register &input = registers[instr->fetch.objectReg]; + Register &output = registers[instr->fetch.output]; + + if (input.isUndefined()) { + throwException(instr->fetch.exceptionId, error, program, context); + return; + } + + QObject *object = input.getQObject(); + if (!object) { + output.setUndefined(); + } else { + void *argv[] = { output.typeDataPtr(), 0 }; QMetaObject::metacall(object, QMetaObject::ReadProperty, instr->fetch.index, argv); } + } break; case Instr::Store: - { - int status = -1; - void *argv[] = { registers[instr->store.reg].typeDataPtr(), - 0, &status, &storeFlags }; - QMetaObject::metacall(outputs[instr->store.output], QMetaObject::WriteProperty, - instr->store.index, argv); + { + Register &data = registers[instr->store.reg]; + if (data.isUndefined()) { + throwException(instr->store.exceptionId, error, program, context, + QLatin1String("Unable to assign undefined value")); + return; } + + int status = -1; + void *argv[] = { data.typeDataPtr(), 0, &status, &storeFlags }; + QMetaObject::metacall(output, QMetaObject::WriteProperty, + instr->store.index, argv); + } break; case Instr::Copy: @@ -856,14 +1317,13 @@ void QmlBindingVME::run(const char *programData, int instrIndex, return; case Instr::InitString: - if (!config->identifiers[instr->initstring.offset].identifier) { + if (!identifiers[instr->initstring.offset].identifier) { quint32 len = *(quint32 *)(data + instr->initstring.dataIdx); QChar *strdata = (QChar *)(data + instr->initstring.dataIdx + sizeof(quint32)); QString str = QString::fromRawData(strdata, len); - config->identifiers[instr->initstring.offset] = - engine->objectClass->createPersistentIdentifier(str); + identifiers[instr->initstring.offset] = engine->objectClass->createPersistentIdentifier(str); } break; @@ -872,68 +1332,81 @@ void QmlBindingVME::run(const char *programData, int instrIndex, // We start the search in the parent context, as we know that the // name is not present in the current context or it would have been // found during the static compile - if (!findgeneric(registers + instr->find.reg, config, instr->find.subscribeIndex, - QmlContextPrivate::get(context->parent), - config->identifiers[instr->find.name].identifier, - instr->common.type == Instr::FindGenericTerminal)) { - qWarning() << "ERROR - FindGeneric*"; - return; - } + findgeneric(registers + instr->find.reg, instr->find.subscribeIndex, + QmlContextPrivate::get(context->parent), + identifiers[instr->find.name].identifier, + instr->common.type == Instr::FindGenericTerminal); break; case Instr::FindPropertyTerminal: case Instr::FindProperty: - if (!findproperty(registers + instr->find.src, registers + instr->find.reg, - QmlEnginePrivate::get(context->engine), - config, instr->find.subscribeIndex, - config->identifiers[instr->find.name].identifier, - instr->common.type == Instr::FindPropertyTerminal)) { - qWarning() << "ERROR - FindProperty*"; + { + const Register &object = registers[instr->find.src]; + if (object.isUndefined()) { + throwException(instr->find.exceptionId, error, program, context); return; } + + findproperty(object.getQObject(), registers + instr->find.reg, + QmlEnginePrivate::get(context->engine), + instr->find.subscribeIndex, identifiers[instr->find.name].identifier, + instr->common.type == Instr::FindPropertyTerminal); + } break; case Instr::CleanupGeneric: - { - int type = registers[instr->cleanup.reg].gettype(); - if (type == qMetaTypeId<QVariant>()) { - registers[instr->cleanup.reg].getvariantptr()->~QVariant(); - } else if (type == QMetaType::QString) { - registers[instr->cleanup.reg].getstringptr()->~QString(); - } else if (type == QMetaType::QUrl) { - registers[instr->cleanup.reg].geturlptr()->~QUrl(); - } + { + int type = registers[instr->cleanup.reg].gettype(); + if (type == qMetaTypeId<QVariant>()) { + registers[instr->cleanup.reg].getvariantptr()->~QVariant(); + } else if (type == QMetaType::QString) { + registers[instr->cleanup.reg].getstringptr()->~QString(); + } else if (type == QMetaType::QUrl) { + registers[instr->cleanup.reg].geturlptr()->~QUrl(); } + } break; case Instr::ConvertGenericToReal: - { - int type = registers[instr->unaryop.src].gettype(); - registers[instr->unaryop.output].setqreal(toReal(registers + instr->unaryop.src, type)); - } + { + Register &output = registers[instr->unaryop.output]; + Register &input = registers[instr->unaryop.src]; + bool ok = true; + output.setqreal(toReal(&input, input.gettype(), &ok)); + if (!ok) output.setUndefined(); + } break; case Instr::ConvertGenericToBool: - { - int type = registers[instr->unaryop.src].gettype(); - registers[instr->unaryop.output].setbool(toBool(registers + instr->unaryop.src, type)); - } + { + Register &output = registers[instr->unaryop.output]; + Register &input = registers[instr->unaryop.src]; + bool ok = true; + output.setbool(toBool(&input, input.gettype(), &ok)); + if (!ok) output.setUndefined(); + } break; case Instr::ConvertGenericToString: - { - int type = registers[instr->unaryop.src].gettype(); - void *regPtr = registers[instr->unaryop.output].typeDataPtr(); - new (regPtr) QString(toString(registers + instr->unaryop.src, type)); - } + { + Register &output = registers[instr->unaryop.output]; + Register &input = registers[instr->unaryop.src]; + bool ok = true; + QString str = toString(&input, input.gettype(), &ok); + if (ok) { new (output.getstringptr()) QString(str); output.settype(QMetaType::QString); } + else { output.setUndefined(); } + } break; case Instr::ConvertGenericToUrl: - { - int type = registers[instr->unaryop.src].gettype(); - void *regPtr = registers[instr->unaryop.output].typeDataPtr(); - new (regPtr) QUrl(toUrl(registers + instr->unaryop.src, type, context)); - } + { + Register &output = registers[instr->unaryop.output]; + Register &input = registers[instr->unaryop.src]; + bool ok = true; + QUrl url = toUrl(&input, input.gettype(), context, &ok); + if (ok) { new (output.geturlptr()) QUrl(url); output.settype(QMetaType::QUrl); } + else { output.setUndefined(); } + } break; default: @@ -945,9 +1418,9 @@ void QmlBindingVME::run(const char *programData, int instrIndex, } } -void QmlBindingVME::dump(const char *programData) +void QmlBindingCompiler::dump(const QByteArray &programData) { - const Program *program = (const Program *)programData; + const Program *program = (const Program *)programData.constData(); qWarning() << "Program.bindings:" << program->bindings; qWarning() << "Program.dataLength:" << program->dataLength; @@ -1110,6 +1583,7 @@ void QmlBindingCompilerPrivate::resetInstanceState() registers = 0; registerCleanups.clear(); data = committed.data; + exceptions = committed.exceptions; usedSubscriptionIds.clear(); subscriptionSet.clear(); subscriptionIds = committed.subscriptionIds; @@ -1130,6 +1604,7 @@ int QmlBindingCompilerPrivate::commitCompile() committed.dependencies << usedSubscriptionIds; committed.bytecode << bytecode; committed.data = data; + committed.exceptions = exceptions; committed.subscriptionIds = subscriptionIds; committed.registeredStrings = registeredStrings; return rv; @@ -1193,6 +1668,7 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node) instr.store.output = 0; instr.store.index = destination->index; instr.store.reg = convertReg; + instr.store.exceptionId = exceptionId(node->expressionCast()); bytecode << instr; if (destination->type == QVariant::String) { @@ -1247,6 +1723,7 @@ bool QmlBindingCompilerPrivate::compile(QmlJS::AST::Node *node) instr.store.output = 0; instr.store.index = destination->index; instr.store.reg = type.reg; + instr.store.exceptionId = exceptionId(node->expressionCast()); bytecode << instr; releaseReg(type.reg); @@ -1294,7 +1771,8 @@ bool QmlBindingCompilerPrivate::tryName(QmlJS::AST::Node *node) bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type) { QStringList nameParts; - if (!buildName(nameParts, node)) + QList<AST::ExpressionNode *> nameNodes; + if (!buildName(nameParts, node, &nameNodes)) return false; int reg = acquireReg(); @@ -1347,6 +1825,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type) attach.attached.output = reg; attach.attached.reg = reg; attach.attached.index = attachType->index(); + attach.attached.exceptionId = exceptionId(nameNodes.at(ii)); bytecode << attach; subscribeName << contextName(); @@ -1414,7 +1893,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type) subscribeName << contextName(); subscribeName << name; - fetch(type, context->metaObject(), reg, d0Idx, subscribeName); + fetch(type, context->metaObject(), reg, d0Idx, subscribeName, nameNodes.at(ii)); } else if(d1Idx != -1) { Instr instr; instr.common.type = Instr::LoadRoot; @@ -1425,7 +1904,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type) subscribeName << QLatin1String("$$$ROOT"); subscribeName << name; - fetch(type, component->metaObject(), reg, d1Idx, subscribeName); + fetch(type, component->metaObject(), reg, d1Idx, subscribeName, nameNodes.at(ii)); } else { Instr find; if (nameParts.count() == 1) @@ -1436,6 +1915,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type) find.find.reg = reg; find.find.src = -1; find.find.name = registerString(name); + find.find.exceptionId = exceptionId(nameNodes.at(ii)); subscribeName << QString(QLatin1String("$$$Generic_") + name); if (subscription(subscribeName, &type)) @@ -1484,7 +1964,7 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type) if (absType || (wasAttachedObject && idx != -1) || (mo && mo->property(idx).isFinal())) { absType = 0; - fetch(type, mo, reg, idx, subscribeName); + fetch(type, mo, reg, idx, subscribeName, nameNodes.at(ii)); if (type.type == -1) return false; } else { @@ -1498,6 +1978,8 @@ bool QmlBindingCompilerPrivate::parseName(AST::Node *node, Result &type) prop.find.reg = reg; prop.find.src = reg; prop.find.name = registerString(name); + prop.find.exceptionId = exceptionId(nameNodes.at(ii)); + if (subscription(subscribeName, &type)) prop.find.subscribeIndex = subscriptionIndex(subscribeName); else @@ -1920,18 +2402,21 @@ bool QmlBindingCompilerPrivate::parseMethod(QmlJS::AST::Node *node, Result &resu } bool QmlBindingCompilerPrivate::buildName(QStringList &name, - QmlJS::AST::Node *node) + QmlJS::AST::Node *node, + QList<QmlJS::AST::ExpressionNode *> *nodes) { if (node->kind == AST::Node::Kind_IdentifierExpression) { name << static_cast<AST::IdentifierExpression*>(node)->name->asString(); + if (nodes) *nodes << static_cast<AST::IdentifierExpression*>(node); } else if (node->kind == AST::Node::Kind_FieldMemberExpression) { AST::FieldMemberExpression *expr = static_cast<AST::FieldMemberExpression *>(node); - if (!buildName(name, expr->base)) + if (!buildName(name, expr->base, nodes)) return false; name << expr->name->asString(); + if (nodes) *nodes << expr; } else { return false; } @@ -1940,7 +2425,8 @@ bool QmlBindingCompilerPrivate::buildName(QStringList &name, } -bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg, int idx, const QStringList &subName) +bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg, + int idx, const QStringList &subName, QmlJS::AST::ExpressionNode *node) { QMetaProperty prop = mo->property(idx); rv.metaObject = 0; @@ -1960,6 +2446,7 @@ bool QmlBindingCompilerPrivate::fetch(Result &rv, const QMetaObject *mo, int reg fetch.fetch.objectReg = reg; fetch.fetch.index = idx; fetch.fetch.output = reg; + fetch.fetch.exceptionId = exceptionId(node); rv.type = prop.userType(); rv.metaObject = QmlMetaType::metaObjectForType(rv.type); @@ -2122,6 +2609,19 @@ bool QmlBindingCompilerPrivate::subscriptionNeutral(const QSet<QString> &base, return difflhs.isEmpty(); } +quint8 QmlBindingCompilerPrivate::exceptionId(QmlJS::AST::ExpressionNode *n) +{ + quint8 rv = 0xFF; + if (n && exceptions.count() < 0xFF) { + rv = (quint8)exceptions.count(); + QmlJS::AST::SourceLocation l = n->firstSourceLocation(); + quint64 e = l.startLine; + e <<= 32; + e |= l.startColumn; + exceptions.append(e); + } + return rv; +} QmlBindingCompiler::QmlBindingCompiler() : d(new QmlBindingCompilerPrivate) @@ -2144,8 +2644,7 @@ bool QmlBindingCompiler::isValid() const /* -1 on failure, otherwise the binding index to use. */ -int QmlBindingCompiler::compile(const QmlBasicScript::Expression &expression, - QmlEnginePrivate *engine) +int QmlBindingCompiler::compile(const Expression &expression, QmlEnginePrivate *engine) { if (!expression.expression.asAST()) return false; @@ -2188,6 +2687,14 @@ QByteArray QmlBindingCompilerPrivate::buildSignalTable() const return QByteArray((const char *)header.constData(), header.count() * sizeof(quint32)); } +QByteArray QmlBindingCompilerPrivate::buildExceptionData() const +{ + QByteArray rv; + rv.resize(committed.exceptions.count() * sizeof(quint64)); + ::memcpy(rv.data(), committed.exceptions.constData(), rv.size()); + return rv; +} + /* Returns the compiled program. */ @@ -2214,6 +2721,9 @@ QByteArray QmlBindingCompiler::program() const while (data.count() % 4) data.append('\0'); prog.signalTableOffset = data.count(); data += d->buildSignalTable(); + while (data.count() % 4) data.append('\0'); + prog.exceptionDataOffset = data.count(); + data += d->buildExceptionData(); prog.dataLength = 4 * ((data.size() + 3) / 4); prog.subscriptions = d->committed.subscriptionIds.count(); @@ -2235,5 +2745,5 @@ QByteArray QmlBindingCompiler::program() const } -QT_END_NAMESPACE +QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlbasicscript_p.h b/src/declarative/qml/qmlcompiledbindings_p.h index c4b436d..1d8fac4 100644 --- a/src/declarative/qml/qmlbasicscript_p.h +++ b/src/declarative/qml/qmlcompiledbindings_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLBASICSCRIPT_P_H -#define QMLBASICSCRIPT_P_H +#ifndef QMLBINDINGOPTIMIZATIONS_P_H +#define QMLBINDINGOPTIMIZATIONS_P_H // // W A R N I N G @@ -53,34 +53,22 @@ // We mean it. // -#include "qmlparser_p.h" -#include "qmlengine_p.h" - -#include <QtCore/QList> -#include <QtCore/QByteArray> -#include <QtCore/QVariant> +#include "qmlexpression_p.h" +#include "qmlbinding.h" QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QmlRefCount; -class QmlContext; -class QmlBasicScriptPrivate; -class QmlBasicScriptNodeCache; -class QmlBasicScript +class QmlBindingCompilerPrivate; +class QmlBindingCompiler { public: - QmlBasicScript(); - ~QmlBasicScript(); - - void load(const char *, QmlRefCount * = 0); - - // Always 4-byte aligned - const char *compileData() const; - unsigned int compileDataSize() const; + QmlBindingCompiler(); + ~QmlBindingCompiler(); - QByteArray expression() const; + // Returns true if bindings were compiled + bool isValid() const; struct Expression { @@ -92,26 +80,37 @@ public: QmlEnginePrivate::Imports imports; }; - bool compile(const Expression &); - bool isValid() const; + // -1 on failure, otherwise the binding index to use + int compile(const Expression &, QmlEnginePrivate *); - void clear(); + // Returns the compiled program + QByteArray program() const; - void dump(); + static void dump(const QByteArray &); +private: + QmlBindingCompilerPrivate *d; +}; - QVariant run(QmlContext *, QObject *); +class QmlCompiledBindingsPrivate; +class QmlCompiledBindings : public QObject, public QmlAbstractExpression, public QmlRefCount +{ +public: + QmlCompiledBindings(const char *program, QmlContext *context); + virtual ~QmlCompiledBindings(); - bool isSingleIdFetch() const; - int singleIdFetchIndex() const; + QmlAbstractBinding *configBinding(int index, QObject *target, QObject *scope, int property); + +protected: + int qt_metacall(QMetaObject::Call, int, void **); private: - int flags; - QmlBasicScriptPrivate *d; - QmlRefCount *rc; + Q_DISABLE_COPY(QmlCompiledBindings); + Q_DECLARE_PRIVATE(QmlCompiledBindings); }; QT_END_NAMESPACE QT_END_HEADER -#endif // QMLBASICSCRIPT_P_H +#endif // QMLBINDINGOPTIMIZATIONS_P_H + diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 4ee59b3..bb7abf3 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -47,7 +47,6 @@ #include "qmlpropertyvaluesource.h" #include "qmlcomponent.h" #include "qmetaobjectbuilder_p.h" -#include "qmlbasicscript_p.h" #include "qmlstringconverters_p.h" #include "qmlengine_p.h" #include "qmlengine.h" @@ -65,7 +64,7 @@ #include "qmlglobal_p.h" #include "qmlscriptparser_p.h" #include "qmlbinding.h" -#include "qmlbindingvme_p.h" +#include "qmlcompiledbindings_p.h" #include <qfxperf_p_p.h> @@ -258,26 +257,30 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, break; case QVariant::Color: { - QColor c = QmlStringConverters::colorFromString(string); - if (!c.isValid()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: color expected")); + bool ok; + QmlStringConverters::colorFromString(string, &ok); + if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: color expected")); } break; case QVariant::Date: { - QDate d = QDate::fromString(string, Qt::ISODate); - if (!d.isValid()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: date expected")); + bool ok; + QmlStringConverters::dateFromString(string, &ok); + if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: date expected")); } break; case QVariant::Time: { - QTime time = QTime::fromString(string, Qt::ISODate); - if (!time.isValid()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: time expected")); + bool ok; + QmlStringConverters::timeFromString(string, &ok); + if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: time expected")); } break; case QVariant::DateTime: { - QDateTime dateTime = QDateTime::fromString(string, Qt::ISODate); - if (!dateTime.isValid()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: datetime expected")); + bool ok; + QmlStringConverters::dateTimeFromString(string, &ok); + if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: datetime expected")); } break; case QVariant::Point: @@ -312,7 +315,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop, case QVariant::Vector3D: { bool ok; - QVector3D point = QmlStringConverters::vector3DFromString(string, &ok); + QmlStringConverters::vector3DFromString(string, &ok); if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: 3D vector expected")); } break; @@ -418,7 +421,7 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop, break; case QVariant::Date: { - QDate d = QDate::fromString(string, Qt::ISODate); + QDate d = QmlStringConverters::dateFromString(string); instr.type = QmlInstruction::StoreDate; instr.storeDate.propertyIndex = prop.propertyIndex(); instr.storeDate.value = d.toJulianDay(); @@ -426,7 +429,7 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop, break; case QVariant::Time: { - QTime time = QTime::fromString(string, Qt::ISODate); + QTime time = QmlStringConverters::timeFromString(string); int data[] = { time.hour(), time.minute(), time.second(), time.msec() }; int index = output->indexForInt(data, 4); @@ -437,7 +440,7 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop, break; case QVariant::DateTime: { - QDateTime dateTime = QDateTime::fromString(string, Qt::ISODate); + QDateTime dateTime = QmlStringConverters::dateTimeFromString(string); int data[] = { dateTime.date().toJulianDay(), dateTime.time().hour(), dateTime.time().minute(), @@ -1610,7 +1613,7 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop, store.assignValueSource.property = genPropertyData(prop); store.assignValueSource.owner = 0; } - QmlType *valueType = QmlMetaType::qmlType(v->object->metatype); + QmlType *valueType = toQmlType(v->object); store.assignValueSource.castValue = valueType->propertyValueSourceCast(); output->bytecode << store; @@ -1627,7 +1630,7 @@ void QmlCompiler::genPropertyAssignment(QmlParser::Property *prop, store.assignValueInterceptor.property = genPropertyData(prop); store.assignValueInterceptor.owner = 0; } - QmlType *valueType = QmlMetaType::qmlType(v->object->metatype); + QmlType *valueType = toQmlType(v->object); store.assignValueInterceptor.castValue = valueType->propertyValueInterceptorCast(); output->bytecode << store; @@ -1995,7 +1998,7 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop, bool isPropertyValue = false; // Will be true if the assigned type inherits QmlPropertyValueInterceptor bool isPropertyInterceptor = false; - if (QmlType *valueType = QmlMetaType::qmlType(v->object->metatype)) { + if (QmlType *valueType = toQmlType(v->object)) { isPropertyValue = valueType->propertyValueSourceCast() != -1; isPropertyInterceptor = valueType->propertyValueInterceptorCast() != -1; } @@ -2388,7 +2391,6 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode) } for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) { - const Object::DynamicSlot &s = obj->dynamicSlots.at(ii); const QString &funcScript = funcScripts.at(ii); QmlVMEMetaData::MethodData *data = ((QmlVMEMetaData *)dynamicData.data())->methodData() + ii; @@ -2559,23 +2561,6 @@ void QmlCompiler::genBindingAssignment(QmlParser::Value *binding, } QmlInstruction store; - - QmlBasicScript bs; - if (ref.dataType == BindingReference::BasicScript) - bs.load(ref.compiledData.constData() + sizeof(quint32)); - - if (bs.isSingleIdFetch()) { - int idIndex = bs.singleIdFetchIndex(); - QmlParser::Object *idObj = compileState.idIndexes.value(idIndex); - if (canCoerce(prop->type, idObj)) { - store.type = QmlInstruction::StoreIdOptBinding; - store.assignIdOptBinding.id = idIndex; - store.assignIdOptBinding.property = prop->index; - output->bytecode << store; - return; - } - } - store.type = QmlInstruction::StoreBinding; store.assignBinding.value = output->indexForByteArray(ref.compiledData); store.assignBinding.context = ref.bindingContext.stack; @@ -2629,7 +2614,7 @@ bool QmlCompiler::completeComponentBuild() COMPILE_CHECK(buildDynamicMeta(aliasObject, ResolveAliases)); } - QmlBasicScript::Expression expr; + QmlBindingCompiler::Expression expr; expr.component = compileState.root; expr.ids = compileState.ids; @@ -2638,15 +2623,12 @@ bool QmlCompiler::completeComponentBuild() for (QHash<QmlParser::Value*,BindingReference>::Iterator iter = compileState.bindings.begin(); iter != compileState.bindings.end(); ++iter) { BindingReference &binding = *iter; - QmlBasicScript bs; expr.context = binding.bindingContext.object; expr.property = binding.property; expr.expression = binding.expression; expr.imports = unit->imports; - bs.compile(expr); - - if (qmlExperimental() && (!bs.isValid() || !bs.isSingleIdFetch())) { + if (qmlExperimental()) { int index = bindingCompiler.compile(expr, QmlEnginePrivate::get(engine)); if (index != -1) { qWarning() << "Accepted for optimization:" << qPrintable(expr.expression.asScript()); @@ -2659,55 +2641,42 @@ bool QmlCompiler::completeComponentBuild() } } - quint32 type; - if (bs.isValid()) { - binding.compiledData = - QByteArray(bs.compileData(), bs.compileDataSize()); - type = QmlExpressionPrivate::BasicScriptEngineData; - binding.dataType = BindingReference::BasicScript; + binding.dataType = BindingReference::QtScript; - componentStat.optimizedBindings++; - } else { - type = QmlExpressionPrivate::PreTransformedQtScriptData; - binding.dataType = BindingReference::QtScript; - - // Pre-rewrite the expression - QString expression = binding.expression.asScript(); - - // ### Optimize - QmlRewrite::SharedBindingTester sharableTest; - bool isSharable = sharableTest.isSharable(expression); - - QmlRewrite::RewriteBinding rewriteBinding; - expression = rewriteBinding(expression); - - quint32 length = expression.length(); - quint32 pc; - - if (isSharable) { - pc = output->cachedClosures.count(); - pc |= 0x80000000; - output->cachedClosures.append(0); - } else { - pc = output->cachedPrograms.length(); - output->cachedPrograms.append(0); - } + // Pre-rewrite the expression + QString expression = binding.expression.asScript(); - binding.compiledData = - QByteArray((const char *)&pc, sizeof(quint32)) + - QByteArray((const char *)&length, sizeof(quint32)) + - QByteArray((const char *)expression.constData(), - expression.length() * sizeof(QChar)); + // ### Optimize + QmlRewrite::SharedBindingTester sharableTest; + bool isSharable = sharableTest.isSharable(expression); + + QmlRewrite::RewriteBinding rewriteBinding; + expression = rewriteBinding(expression); - componentStat.scriptBindings++; + quint32 length = expression.length(); + quint32 pc; + + if (isSharable) { + pc = output->cachedClosures.count(); + pc |= 0x80000000; + output->cachedClosures.append(0); + } else { + pc = output->cachedPrograms.length(); + output->cachedPrograms.append(0); } - binding.compiledData.prepend(QByteArray((const char *)&type, - sizeof(quint32))); + + binding.compiledData = + QByteArray((const char *)&pc, sizeof(quint32)) + + QByteArray((const char *)&length, sizeof(quint32)) + + QByteArray((const char *)expression.constData(), + expression.length() * sizeof(QChar)); + + componentStat.scriptBindings++; } if (bindingCompiler.isValid()) { compileState.compiledBindingData = bindingCompiler.program(); - QmlBindingVME::dump(compileState.compiledBindingData); + QmlBindingCompiler::dump(compileState.compiledBindingData); } saveComponentState(); diff --git a/src/declarative/qml/qmlcompiler_p.h b/src/declarative/qml/qmlcompiler_p.h index 732fbad..f3f266b 100644 --- a/src/declarative/qml/qmlcompiler_p.h +++ b/src/declarative/qml/qmlcompiler_p.h @@ -279,7 +279,7 @@ private: QmlParser::Property *property; QmlParser::Value *value; - enum DataType { QtScript, BasicScript, Experimental }; + enum DataType { QtScript, Experimental }; DataType dataType; int compiledIndex; diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index e7ac864..0eb497d 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -45,7 +45,7 @@ #include "qmlexpression_p.h" #include "qmlengine_p.h" #include "qmlengine.h" -#include "qmlbindingoptimizations_p.h" +#include "qmlcompiledbindings_p.h" #include "qmlinfo.h" #include <qscriptengine.h> @@ -105,8 +105,12 @@ void QmlContextPrivate::destroyed(ContextGuard *guard) if (parent && QObjectPrivate::get(parent)->wasDeleted) return; - while(guard->bindings) - guard->bindings->reset(); + while(guard->bindings) { + QObject *o = guard->bindings->target; + int mi = guard->bindings->methodIndex; + guard->bindings->clear(); + if (o) o->qt_metacall(QMetaObject::InvokeMetaMethod, mi, 0); + } for (int ii = 0; ii < idValueCount; ++ii) { if (&idValues[ii] == guard) { diff --git a/src/declarative/qml/qmlcontext.h b/src/declarative/qml/qmlcontext.h index 7547004..bf389a0 100644 --- a/src/declarative/qml/qmlcontext.h +++ b/src/declarative/qml/qmlcontext.h @@ -88,7 +88,6 @@ private: friend class QmlEnginePrivate; friend class QmlExpression; friend class QmlExpressionPrivate; - friend class QmlBasicScript; friend class QmlContextScriptClass; friend class QmlObjectScriptClass; friend class QmlComponent; diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h index e682ee2..cd7e1b6 100644 --- a/src/declarative/qml/qmlcontext_p.h +++ b/src/declarative/qml/qmlcontext_p.h @@ -76,7 +76,7 @@ class QmlExpression; class QmlExpressionPrivate; class QmlAbstractExpression; class QmlBinding_Id; -class QmlOptimizedBindings; +class QmlCompiledBindings; class Q_DECLARATIVE_EXPORT QmlContextPrivate : public QObjectPrivate { @@ -113,15 +113,27 @@ public: QmlDeclarativeData *contextObjects; + struct IdNotifier + { + inline IdNotifier(); + inline ~IdNotifier(); + + inline void clear(); + + IdNotifier *next; + IdNotifier**prev; + QObject *target; + int methodIndex; + }; + struct ContextGuard : public QmlGuard<QObject> { - ContextGuard() : priv(0), bindings(0) {} + inline ContextGuard(); + inline ContextGuard &operator=(QObject *obj); + inline virtual void objectDestroyed(QObject *); + QmlContextPrivate *priv; - QmlBinding_Id *bindings; - ContextGuard &operator=(QObject *obj) { - (QmlGuard<QObject>&)*this = obj; return *this; - } - void objectDestroyed(QObject *) { priv->destroyed(this); } + IdNotifier *bindings; }; ContextGuard *idValues; int idValueCount; @@ -136,12 +148,45 @@ public: return static_cast<QmlContext *>(context->q_func()); } - QmlOptimizedBindings *optimizedBindings; + QmlCompiledBindings *optimizedBindings; // Only used for debugging QList<QPointer<QObject> > instances; }; +QmlContextPrivate::IdNotifier::IdNotifier() +: next(0), prev(0), target(0), methodIndex(-1) +{ +} + +QmlContextPrivate::IdNotifier::~IdNotifier() +{ + clear(); +} + +void QmlContextPrivate::IdNotifier::clear() +{ + if (next) next->prev = prev; + if (prev) *prev = next; + next = 0; prev = 0; target = 0; + methodIndex = -1; +} + +QmlContextPrivate::ContextGuard::ContextGuard() +: priv(0), bindings(0) +{ +} + +QmlContextPrivate::ContextGuard &QmlContextPrivate::ContextGuard::operator=(QObject *obj) +{ + (QmlGuard<QObject>&)*this = obj; return *this; +} + +void QmlContextPrivate::ContextGuard::objectDestroyed(QObject *) +{ + priv->destroyed(this); +} + QT_END_NAMESPACE #endif // QMLCONTEXT_P_H diff --git a/src/declarative/qml/qmlcontextscriptclass.cpp b/src/declarative/qml/qmlcontextscriptclass.cpp index 8ab3f8d..80d52ad 100644 --- a/src/declarative/qml/qmlcontextscriptclass.cpp +++ b/src/declarative/qml/qmlcontextscriptclass.cpp @@ -77,7 +77,7 @@ struct ContextData : public QScriptDeclarativeClass::Object { via QtScript. */ QmlContextScriptClass::QmlContextScriptClass(QmlEngine *bindEngine) -: QScriptDeclarativeClass(QmlEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine), +: QmlScriptClass(QmlEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine), lastScopeObject(0), lastContext(0), lastData(0), lastPropertyIndex(-1), lastDefaultObject(-1) { } @@ -174,7 +174,8 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje if (scopeObject) { QScriptClass::QueryFlags rv = - ep->objectClass->queryProperty(scopeObject, name, flags, bindContext, QmlObjectScriptClass::ImplicitObject); + ep->objectClass->queryProperty(scopeObject, name, flags, bindContext, + QmlObjectScriptClass::ImplicitObject | QmlObjectScriptClass::SkipAttachedProperties); if (rv) { lastScopeObject = scopeObject; lastContext = bindContext; @@ -184,7 +185,8 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje for (int ii = cp->defaultObjects.count() - 1; ii >= 0; --ii) { QScriptClass::QueryFlags rv = - ep->objectClass->queryProperty(cp->defaultObjects.at(ii), name, flags, bindContext, QmlObjectScriptClass::ImplicitObject); + ep->objectClass->queryProperty(cp->defaultObjects.at(ii), name, flags, bindContext, + QmlObjectScriptClass::ImplicitObject | QmlObjectScriptClass::SkipAttachedProperties); if (rv) { lastDefaultObject = ii; @@ -196,7 +198,7 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje return 0; } -QmlContextScriptClass::Value +QmlContextScriptClass::ScriptValue QmlContextScriptClass::property(Object *object, const Identifier &name) { Q_UNUSED(object); @@ -206,6 +208,7 @@ QmlContextScriptClass::property(Object *object, const Identifier &name) QmlEnginePrivate *ep = QmlEnginePrivate::get(engine); QmlContextPrivate *cp = QmlContextPrivate::get(bindContext); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); if (lastScopeObject) { @@ -214,9 +217,9 @@ QmlContextScriptClass::property(Object *object, const Identifier &name) } else if (lastData) { if (lastData->type) - return ep->typeNameClass->newObject(cp->defaultObjects.at(0), lastData->type); + return Value(scriptEngine, ep->typeNameClass->newObject(cp->defaultObjects.at(0), lastData->type)); else - return ep->typeNameClass->newObject(cp->defaultObjects.at(0), lastData->typeNamespace); + return Value(scriptEngine, ep->typeNameClass->newObject(cp->defaultObjects.at(0), lastData->typeNamespace)); } else if (lastPropertyIndex != -1) { @@ -231,7 +234,7 @@ QmlContextScriptClass::property(Object *object, const Identifier &name) ep->capturedProperties << QmlEnginePrivate::CapturedProperty(bindContext, -1, lastPropertyIndex + cp->notifyIndex); - return rv; + return Value(scriptEngine, rv); } else if(lastDefaultObject != -1) { // Default object property @@ -239,7 +242,7 @@ QmlContextScriptClass::property(Object *object, const Identifier &name) } else { - return lastFunction; + return Value(scriptEngine, lastFunction); } } diff --git a/src/declarative/qml/qmlcontextscriptclass_p.h b/src/declarative/qml/qmlcontextscriptclass_p.h index f652371..f98d44f 100644 --- a/src/declarative/qml/qmlcontextscriptclass_p.h +++ b/src/declarative/qml/qmlcontextscriptclass_p.h @@ -54,16 +54,13 @@ // #include "qmltypenamecache_p.h" - -#include <QtScript/qscriptclass.h> - -#include <private/qscriptdeclarativeclass_p.h> +#include "qmlscriptclass_p.h" QT_BEGIN_NAMESPACE class QmlEngine; class QmlContext; -class QmlContextScriptClass : public QScriptDeclarativeClass +class QmlContextScriptClass : public QmlScriptClass { public: QmlContextScriptClass(QmlEngine *); @@ -77,7 +74,7 @@ public: protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual Value property(Object *, const Identifier &); + virtual ScriptValue property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); private: diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index b5e7c2d..b3ac1bb 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -46,7 +46,6 @@ #include "qmlcompiler_p.h" #include "qmlglobalscriptclass_p.h" #include "qml.h" -#include "qmlbasicscript_p.h" #include "qmlcontext.h" #include "qmlexpression.h" #include "qmlcomponent.h" @@ -64,6 +63,8 @@ #include "qmlglobal_p.h" #include "qmlworkerscript_p.h" #include "qmlcomponent_p.h" +#include "qmlscriptclass_p.h" +#include "qmlnetworkaccessmanagerfactory.h" #include <qfxperf_p_p.h> @@ -121,7 +122,8 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e) contextClass(0), sharedContext(0), sharedScope(0), objectClass(0), valueTypeClass(0), globalClass(0), cleanup(0), erroredBindings(0), inProgressCreations(0), scriptEngine(this), workerScriptEngine(0), componentAttacheds(0), inBeginCreate(false), - networkAccessManager(0), typeManager(e), uniqueId(1) + networkAccessManager(0), networkAccessManagerFactory(0), accessManagerValid(false), + typeManager(e), uniqueId(1) { globalClass = new QmlGlobalScriptClass(&scriptEngine); fileImportPath.append(QLibraryInfo::location(QLibraryInfo::DataPath)+QDir::separator()+QLatin1String("qml")); @@ -386,34 +388,64 @@ QmlContext *QmlEngine::rootContext() } /*! - Sets the common QNetworkAccessManager, \a network, used by all QML elements - instantiated by this engine. + Sets the \a factory to use for creating QNetworkAccessManager(s). + + QNetworkAccessManager is used for all network access by QML. + By implementing a factory it is possible to create custom + QNetworkAccessManager with specialized caching, proxy and + cookie support. +*/ +void QmlEngine::setNetworkAccessManagerFactory(QmlNetworkAccessManagerFactory *factory) +{ + Q_D(QmlEngine); + d->networkAccessManagerFactory = factory; +} - If the parent of \a network is this engine, the engine takes ownership and - will delete it as needed. Otherwise, ownership remains with the caller. +/*! + Returns the current QmlNetworkAccessManagerFactory. - This method should only be called before any QmlComponents are instantiated. + \sa setNetworkAccessManagerFactory() */ -void QmlEngine::setNetworkAccessManager(QNetworkAccessManager *network) +QmlNetworkAccessManagerFactory *QmlEngine::networkAccessManagerFactory() const +{ + Q_D(const QmlEngine); + return d->networkAccessManagerFactory; +} + +void QmlEngine::namInvalidated() { Q_D(QmlEngine); - if (d->networkAccessManager && d->networkAccessManager->parent() == this) - delete d->networkAccessManager; - d->networkAccessManager = network; + d->accessManagerValid = false; } /*! - Returns the common QNetworkAccessManager used by all QML elements + Returns a common QNetworkAccessManager which can be used by any QML element instantiated by this engine. - The default implements no caching, cookiejar, etc., just a default - QNetworkAccessManager. + If a QmlNetworkAccessManagerFactory has been set and a QNetworkAccessManager + has not yet been created, the QmlNetworkAccessManagerFactory will be used + to create the QNetworkAccessManager; otherwise the returned QNetworkAccessManager + will have no proxy or cache set. + + \sa setNetworkAccessManagerFactory() */ QNetworkAccessManager *QmlEngine::networkAccessManager() const { Q_D(const QmlEngine); - if (!d->networkAccessManager) - d->networkAccessManager = new QNetworkAccessManager(const_cast<QmlEngine*>(this)); + if (!d->accessManagerValid) { + delete d->networkAccessManagerFactory; + d->networkAccessManagerFactory = 0; + } + if (!d->networkAccessManager) { + if (d->networkAccessManagerFactory) { + connect(d->networkAccessManagerFactory, SIGNAL(invalidated()) + , this, SLOT(namInvalidated()), Qt::UniqueConnection); + d->networkAccessManager = d->networkAccessManagerFactory->create(const_cast<QmlEngine*>(this)); + } else { + d->networkAccessManager = new QNetworkAccessManager(const_cast<QmlEngine*>(this)); + } + d->accessManagerValid = true; + } return d->networkAccessManager; } @@ -1056,9 +1088,8 @@ QVariant QmlEnginePrivate::scriptValueToVariant(const QScriptValue &val) } } -QmlScriptClass::QmlScriptClass(QmlEngine *bindengine) -: QScriptClass(QmlEnginePrivate::getScriptEngine(bindengine)), - engine(bindengine) +QmlScriptClass::QmlScriptClass(QScriptEngine *engine) +: QScriptDeclarativeClass(engine) { } diff --git a/src/declarative/qml/qmlengine.h b/src/declarative/qml/qmlengine.h index 7cbbcac..b9ec277 100644 --- a/src/declarative/qml/qmlengine.h +++ b/src/declarative/qml/qmlengine.h @@ -63,6 +63,7 @@ class QUrl; class QScriptEngine; class QScriptContext; class QNetworkAccessManager; +class QmlNetworkAccessManagerFactory; class Q_DECLARATIVE_EXPORT QmlEngine : public QObject { Q_PROPERTY(QString offlineStoragePath READ offlineStoragePath WRITE setOfflineStoragePath) @@ -77,7 +78,9 @@ public: void addImportPath(const QString& dir); - void setNetworkAccessManager(QNetworkAccessManager *); + void setNetworkAccessManagerFactory(QmlNetworkAccessManagerFactory *); + QmlNetworkAccessManagerFactory *networkAccessManagerFactory() const; + QNetworkAccessManager *networkAccessManager() const; void setOfflineStoragePath(const QString& dir); @@ -92,6 +95,9 @@ public: Q_SIGNALS: void quit (); +private Q_SLOTS: + void namInvalidated(); + private: Q_DECLARE_PRIVATE(QmlEngine) }; diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h index 2f177a2..6f62b40 100644 --- a/src/declarative/qml/qmlengine_p.h +++ b/src/declarative/qml/qmlengine_p.h @@ -92,6 +92,7 @@ class QmlValueTypeScriptClass; class QScriptEngineDebugger; class QNetworkReply; class QNetworkAccessManager; +class QmlNetworkAccessManagerFactory; class QmlAbstractBinding; class QScriptDeclarativeClass; class QmlTypeNameScriptClass; @@ -99,8 +100,9 @@ class QmlTypeNameCache; class QmlComponentAttached; class QmlListScriptClass; class QmlCleanup; -class QmlBindingData; +class QmlDelayedError; class QmlWorkerScriptEngine; +class QmlGlobalScriptClass; class QmlScriptEngine : public QScriptEngine { @@ -160,13 +162,13 @@ public: QmlTypeNameScriptClass *typeNameClass; QmlListScriptClass *listClass; // Global script class - QScriptClass *globalClass; + QmlGlobalScriptClass *globalClass; // Registered cleanup handlers QmlCleanup *cleanup; // Bindings that have had errors during startup - QmlBindingData *erroredBindings; + QmlDelayedError *erroredBindings; int inProgressCreations; QmlScriptEngine scriptEngine; @@ -208,6 +210,8 @@ public: bool inBeginCreate; mutable QNetworkAccessManager *networkAccessManager; + mutable QmlNetworkAccessManagerFactory *networkAccessManagerFactory; + mutable bool accessManagerValid; QmlCompositeTypeManager typeManager; QStringList fileImportPath; @@ -307,16 +311,6 @@ public: }; -class QmlScriptClass : public QScriptClass -{ -public: - QmlScriptClass(QmlEngine *); - - static QVariant toVariant(QmlEngine *, const QScriptValue &); -protected: - QmlEngine *engine; -}; - QT_END_NAMESPACE #endif // QMLENGINE_P_H diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index cd6f582..3e8d71a 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -56,6 +56,20 @@ Q_DECLARE_METATYPE(QList<QObject *>); QT_BEGIN_NAMESPACE +bool QmlDelayedError::addError(QmlEnginePrivate *e) +{ + if (!e || prevError) return false; + + if (e->inProgressCreations == 0) return false; // Not in construction + + prevError = &e->erroredBindings; + nextError = e->erroredBindings; + e->erroredBindings = this; + if (nextError) nextError->prevError = &nextError; + + return true; +} + QmlExpressionData::QmlExpressionData() : expressionFunctionValid(false), expressionRewritten(false), me(0), trackChange(true), isShared(false), line(-1), guardList(0), guardListLength(0) @@ -100,52 +114,46 @@ void QmlExpressionPrivate::init(QmlContext *ctxt, void *expr, QmlRefCount *rc, data->line = lineNumber; quint32 *exprData = (quint32 *)expr; - Q_ASSERT(*exprData == BasicScriptEngineData || - *exprData == PreTransformedQtScriptData); - if (*exprData == BasicScriptEngineData) { - data->sse.load((const char *)(exprData + 1), rc); - } else { - QmlCompiledData *dd = (QmlCompiledData *)rc; + QmlCompiledData *dd = (QmlCompiledData *)rc; - data->expressionRewritten = true; - data->expression = QString::fromRawData((QChar *)(exprData + 3), exprData[2]); + data->expressionRewritten = true; + data->expression = QString::fromRawData((QChar *)(exprData + 2), exprData[1]); - int progIdx = *(exprData + 1); - bool isShared = progIdx & 0x80000000; - progIdx &= 0x7FFFFFFF; + int progIdx = *(exprData); + bool isShared = progIdx & 0x80000000; + progIdx &= 0x7FFFFFFF; - QmlEngine *engine = ctxt->engine(); - QmlEnginePrivate *ep = QmlEnginePrivate::get(engine); - QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); + QmlEngine *engine = ctxt->engine(); + QmlEnginePrivate *ep = QmlEnginePrivate::get(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); - if (isShared) { + if (isShared) { - if (!dd->cachedClosures.at(progIdx)) { - QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine); - scriptContext->pushScope(ep->contextClass->newSharedContext()); - dd->cachedClosures[progIdx] = new QScriptValue(scriptEngine->evaluate(data->expression, data->url, data->line)); - scriptEngine->popContext(); - } + if (!dd->cachedClosures.at(progIdx)) { + QScriptContext *scriptContext = QScriptDeclarativeClass::pushCleanContext(scriptEngine); + scriptContext->pushScope(ep->contextClass->newSharedContext()); + dd->cachedClosures[progIdx] = new QScriptValue(scriptEngine->evaluate(data->expression, data->url, data->line)); + scriptEngine->popContext(); + } - data->expressionFunction = *dd->cachedClosures.at(progIdx); - data->isShared = true; - data->expressionFunctionValid = true; + data->expressionFunction = *dd->cachedClosures.at(progIdx); + data->isShared = true; + data->expressionFunctionValid = true; - } else { + } else { #if !defined(Q_OS_SYMBIAN) //XXX Why doesn't this work? - if (!dd->cachedPrograms.at(progIdx)) { - dd->cachedPrograms[progIdx] = - new QScriptProgram(data->expression, data->url, data->line); - } + if (!dd->cachedPrograms.at(progIdx)) { + dd->cachedPrograms[progIdx] = + new QScriptProgram(data->expression, data->url, data->line); + } - data->expressionFunction = evalInObjectScope(ctxt, me, *dd->cachedPrograms.at(progIdx)); + data->expressionFunction = evalInObjectScope(ctxt, me, *dd->cachedPrograms.at(progIdx)); #else - data->expressionFunction = evalInObjectScope(ctxt, me, data->expression); + data->expressionFunction = evalInObjectScope(ctxt, me, data->expression); #endif - data->expressionFunctionValid = true; - } + data->expressionFunctionValid = true; } data->QmlAbstractExpression::setContext(ctxt); @@ -258,10 +266,7 @@ QmlContext *QmlExpression::context() const QString QmlExpression::expression() const { Q_D(const QmlExpression); - if (d->data->sse.isValid()) - return QString::fromUtf8(d->data->sse.expression()); - else - return d->data->expression; + return d->data->expression; } /*! @@ -285,19 +290,6 @@ void QmlExpression::setExpression(const QString &expression) d->data->expressionFunctionValid = false; d->data->expressionRewritten = false; d->data->expressionFunction = QScriptValue(); - - d->data->sse.clear(); -} - -QVariant QmlExpressionPrivate::evalSSE() -{ -#ifdef Q_ENABLE_PERFORMANCE_LOG - QmlPerfTimer<QmlPerf::BindValueSSE> perfsse; -#endif - - QVariant rv = data->sse.run(data->context(), data->me); - - return rv; } void QmlExpressionPrivate::exceptionToError(QScriptEngine *scriptEngine, @@ -442,7 +434,7 @@ QVariant QmlExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) return rv; } - if (!data->sse.isValid() && data->expression.isEmpty()) + if (data->expression.isEmpty()) return rv; #ifdef Q_ENABLE_PERFORMANCE_LOG @@ -463,11 +455,7 @@ QVariant QmlExpressionPrivate::value(QObject *secondaryScope, bool *isUndefined) QmlExpressionData *localData = data; localData->addref(); - if (data->sse.isValid()) { - rv = evalSSE(); - } else { - rv = evalQtScript(secondaryScope, isUndefined); - } + rv = evalQtScript(secondaryScope, isUndefined); ep->currentExpression = lastCurrentExpression; ep->captureProperties = lastCaptureProperties; @@ -641,9 +629,16 @@ void QmlExpressionPrivate::clearGuards() for (int ii = 0; ii < data->guardListLength; ++ii) { if (data->guardList[ii].data()) { +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) QMetaObject::disconnectOne(data->guardList[ii].data(), data->guardList[ii].notifyIndex, q, notifyIdx); +#else + // QTBUG-6781 + QMetaObject::disconnect(data->guardList[ii].data(), + data->guardList[ii].notifyIndex, + q, notifyIdx); +#endif } } @@ -684,9 +679,16 @@ void QmlExpressionPrivate::updateGuards(const QPODVector<QmlEnginePrivate::Captu } } else if(data->guardList[ii].data() && !data->guardList[ii].isDuplicate) { // Cache miss +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) QMetaObject::disconnectOne(data->guardList[ii].data(), data->guardList[ii].notifyIndex, q, notifyIdx); +#else + // QTBUG-6781 + QMetaObject::disconnect(data->guardList[ii].data(), + data->guardList[ii].notifyIndex, + q, notifyIdx); +#endif } /* else { // Cache miss, but nothing to do @@ -732,9 +734,16 @@ void QmlExpressionPrivate::updateGuards(const QPODVector<QmlEnginePrivate::Captu for (int ii = properties.count(); ii < data->guardListLength; ++ii) { if (data->guardList[ii].data() && !data->guardList[ii].isDuplicate) { +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) QMetaObject::disconnectOne(data->guardList[ii].data(), data->guardList[ii].notifyIndex, q, notifyIdx); +#else + // QTBUG-6781 + QMetaObject::disconnect(data->guardList[ii].data(), + data->guardList[ii].notifyIndex, + q, notifyIdx); +#endif } } diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h index cc02d56..4df7641 100644 --- a/src/declarative/qml/qmlexpression.h +++ b/src/declarative/qml/qmlexpression.h @@ -58,7 +58,6 @@ class QmlRefCount; class QmlEngine; class QmlContext; class QmlExpressionPrivate; -class QmlBasicScript; class Q_DECLARATIVE_EXPORT QmlExpression : public QObject { Q_OBJECT diff --git a/src/declarative/qml/qmlexpression_p.h b/src/declarative/qml/qmlexpression_p.h index 8561a57..1fbb075 100644 --- a/src/declarative/qml/qmlexpression_p.h +++ b/src/declarative/qml/qmlexpression_p.h @@ -55,7 +55,6 @@ #include "qmlexpression.h" -#include "qmlbasicscript_p.h" #include "qmlengine_p.h" #include "qmlguard_p.h" @@ -84,7 +83,30 @@ private: QmlAbstractExpression *m_nextExpression; }; -class QmlExpressionData : public QmlAbstractExpression, public QmlRefCount +class QmlDelayedError +{ +public: + inline QmlDelayedError() : nextError(0), prevError(0) {} + inline ~QmlDelayedError() { removeError(); } + + QmlError error; + + bool addError(QmlEnginePrivate *); + + inline void removeError() { + if (!prevError) return; + if (nextError) nextError->prevError = prevError; + *prevError = nextError; + nextError = 0; + prevError = 0; + } + +private: + QmlDelayedError *nextError; + QmlDelayedError **prevError; +}; + +class QmlExpressionData : public QmlAbstractExpression, public QmlDelayedError, public QmlRefCount { public: QmlExpressionData(); @@ -97,9 +119,6 @@ public: bool expressionRewritten:1; QScriptValue expressionFunction; - QmlError error; - - QmlBasicScript sse; QObject *me; bool trackChange; @@ -139,18 +158,12 @@ public: QmlExpressionPrivate(QmlExpressionData *); ~QmlExpressionPrivate(); - enum CompiledDataType { - BasicScriptEngineData = 1, - PreTransformedQtScriptData = 2 - }; - void init(QmlContext *, const QString &, QObject *); void init(QmlContext *, void *, QmlRefCount *, QObject *, const QString &, int); QmlExpressionData *data; QVariant value(QObject *secondaryScope = 0, bool *isUndefined = 0); - QVariant evalSSE(); QVariant evalQtScript(QObject *secondaryScope, bool *isUndefined = 0); void updateGuards(const QPODVector<QmlEnginePrivate::CapturedProperty> &properties); diff --git a/src/declarative/qml/qmlglobalscriptclass.cpp b/src/declarative/qml/qmlglobalscriptclass.cpp index 5387e03..13c1017 100644 --- a/src/declarative/qml/qmlglobalscriptclass.cpp +++ b/src/declarative/qml/qmlglobalscriptclass.cpp @@ -101,5 +101,21 @@ void QmlGlobalScriptClass::setProperty(QScriptValue &object, engine()->currentContext()->throwError(error); } +void QmlGlobalScriptClass::explicitSetProperty(const QString &name, const QScriptValue &value) +{ + QScriptValue v = engine()->newObject(); + globalObject = engine()->globalObject(); + + QScriptValueIterator iter(globalObject); + while (iter.hasNext()) { + iter.next(); + v.setProperty(iter.scriptName(), iter.value()); + } + + v.setProperty(name, value); + v.setScriptClass(this); + engine()->setGlobalObject(v); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlglobalscriptclass_p.h b/src/declarative/qml/qmlglobalscriptclass_p.h index 1658c27..56c91fe 100644 --- a/src/declarative/qml/qmlglobalscriptclass_p.h +++ b/src/declarative/qml/qmlglobalscriptclass_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -class QmlGlobalScriptClass : public QScriptClass +class Q_AUTOTEST_EXPORT QmlGlobalScriptClass : public QScriptClass { public: QmlGlobalScriptClass(QScriptEngine *); @@ -72,6 +72,8 @@ public: virtual void setProperty(QScriptValue &object, const QScriptString &name, uint id, const QScriptValue &value); + void explicitSetProperty(const QString &, const QScriptValue &); + private: QScriptValue globalObject; }; diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index 2ddad49..d99bf65 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -161,9 +161,6 @@ void QmlCompiledData::dump(QmlInstruction *instr, int idx) case QmlInstruction::StoreCompiledBinding: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context; break; - case QmlInstruction::StoreIdOptBinding: - qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_ID_OPT_BINDING\t" << instr->assignIdOptBinding.property << "\t" << instr->assignIdOptBinding.id; - break; case QmlInstruction::StoreValueSource: qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue; break; diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index 44fa196..0639397 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -129,7 +129,6 @@ public: StoreBinding, /* assignBinding */ StoreCompiledBinding, /* assignBinding */ - StoreIdOptBinding, /* assignIdOptBinding */ StoreValueSource, /* assignValueSource */ StoreValueInterceptor, /* assignValueInterceptor */ diff --git a/src/declarative/qml/qmllistscriptclass.cpp b/src/declarative/qml/qmllistscriptclass.cpp index b275625..d4cdc6e 100644 --- a/src/declarative/qml/qmllistscriptclass.cpp +++ b/src/declarative/qml/qmllistscriptclass.cpp @@ -49,11 +49,12 @@ QT_BEGIN_NAMESPACE struct ListData : public QScriptDeclarativeClass::Object { QmlGuard<QObject> object; int propertyIdx; - QmlListScriptClass::ListType type; + QmlListScriptClass::ListCategory type; + int propertyType; }; QmlListScriptClass::QmlListScriptClass(QmlEngine *e) -: QScriptDeclarativeClass(QmlEnginePrivate::getScriptEngine(e)), engine(e) +: QmlScriptClass(QmlEnginePrivate::getScriptEngine(e)), engine(e) { QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); Q_UNUSED(scriptEngine); @@ -65,7 +66,7 @@ QmlListScriptClass::~QmlListScriptClass() { } -QScriptValue QmlListScriptClass::newList(QObject *object, int propId, ListType type) +QScriptValue QmlListScriptClass::newList(QObject *object, int propId, ListCategory type, int propType) { QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); @@ -76,6 +77,7 @@ QScriptValue QmlListScriptClass::newList(QObject *object, int propId, ListType t data->object = object; data->propertyIdx = propId; data->type = type; + data->propertyType = propType; return newObject(scriptEngine, this, data); } @@ -100,14 +102,14 @@ QmlListScriptClass::queryProperty(Object *object, const Identifier &name, } } -QmlListScriptClass::Value QmlListScriptClass::property(Object *obj, const Identifier &name) +QmlListScriptClass::ScriptValue QmlListScriptClass::property(Object *obj, const Identifier &name) { QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine); ListData *data = (ListData *)obj; if (!data->object) - return scriptEngine->undefinedValue(); + return Value(); void *list = 0; void *args[] = { &list, 0 }; @@ -115,7 +117,7 @@ QmlListScriptClass::Value QmlListScriptClass::property(Object *obj, const Identi data->propertyIdx, args); if (!list) - return scriptEngine->undefinedValue(); + return Value(); if (data->type == QListPtr) { const QList<QObject *> &qlist = *((QList<QObject *>*)list); @@ -125,9 +127,9 @@ QmlListScriptClass::Value QmlListScriptClass::property(Object *obj, const Identi if (name == m_lengthId.identifier) return Value(scriptEngine, count); else if (lastIndex < count) - return enginePriv->objectClass->newQObject(qlist.at(lastIndex)); + return Value(scriptEngine, enginePriv->objectClass->newQObject(qlist.at(lastIndex))); else - return scriptEngine->undefinedValue(); + return Value(); } else { Q_ASSERT(data->type == QmlListPtr); @@ -138,11 +140,34 @@ QmlListScriptClass::Value QmlListScriptClass::property(Object *obj, const Identi if (name == m_lengthId.identifier) return Value(scriptEngine, count); else if (lastIndex < count) - return enginePriv->objectClass->newQObject(qmllist.at(lastIndex)); + return Value(scriptEngine, enginePriv->objectClass->newQObject(qmllist.at(lastIndex))); else - return scriptEngine->undefinedValue(); + return Value(); } } +QVariant QmlListScriptClass::toVariant(Object *obj, bool *ok) +{ + ListData *data = (ListData *)obj; + + if (!data->object) { + if (ok) *ok = false; + return QVariant(); + } + + void *list = 0; + void *args[] = { &list, 0 }; + QMetaObject::metacall(data->object, QMetaObject::ReadProperty, + data->propertyIdx, args); + + if (!list) { + if (ok) *ok = false; + return QVariant(); + } + + if (ok) *ok = true; + return QVariant(data->propertyType, &list); +} + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmllistscriptclass_p.h b/src/declarative/qml/qmllistscriptclass_p.h index 43ca929..e484b34 100644 --- a/src/declarative/qml/qmllistscriptclass_p.h +++ b/src/declarative/qml/qmllistscriptclass_p.h @@ -53,24 +53,25 @@ // We mean it. // -#include <private/qscriptdeclarativeclass_p.h> +#include <private/qmlscriptclass_p.h> QT_BEGIN_NAMESPACE class QmlEngine; -class QmlListScriptClass : public QScriptDeclarativeClass +class QmlListScriptClass : public QmlScriptClass { public: QmlListScriptClass(QmlEngine *); ~QmlListScriptClass(); - enum ListType { QListPtr, QmlListPtr }; - QScriptValue newList(QObject *, int, ListType); + enum ListCategory { QListPtr, QmlListPtr }; + QScriptValue newList(QObject *, int, ListCategory, int); protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual Value property(Object *, const Identifier &); + virtual ScriptValue property(Object *, const Identifier &); + virtual QVariant toVariant(Object *, bool *ok); private: PersistentIdentifier m_lengthId; diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index 6738370..0603a9c 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -46,10 +46,12 @@ #include "qml.h" #include "qmlbinding.h" #include "qmlcontext.h" +#include "qmlcontext_p.h" #include "qmlboundsignal_p.h" #include "qmlengine.h" #include "qmlengine_p.h" #include "qmldeclarativedata_p.h" +#include "qmlstringconverters_p.h" #include <qfxperf_p_p.h> @@ -160,17 +162,13 @@ void QmlMetaPropertyPrivate::initProperty(QObject *obj, const QString &name) if (enginePrivate && name.at(0).isUpper()) { // Attached property - //### needs to be done in a better way - QmlCompositeTypeData *typeData = - enginePrivate->typeManager.get(context->baseUrl()); - - if (typeData) { - QmlType *t = 0; - enginePrivate->resolveType(typeData->imports, name.toUtf8(), &t, 0, 0, 0, 0); - if (t && t->attachedPropertiesFunction()) { - attachedFunc = t->index(); + // ### What about qualified types? + QmlTypeNameCache *tnCache = QmlContextPrivate::get(context)->imports; + if (tnCache) { + QmlTypeNameCache::Data *d = tnCache->data(name); + if (d && d->type && d->type->attachedPropertiesFunction()) { + attachedFunc = d->type->index(); } - typeData->release(); } return; @@ -438,6 +436,17 @@ bool QmlMetaProperty::isDesignable() const } /*! + Returns true if the property is resettable, otherwise false. +*/ +bool QmlMetaProperty::isResettable() const +{ + if (type() & Property && d->core.isValid() && d->object) + return d->core.flags & QmlPropertyCache::Data::IsResettable; + else + return false; +} + +/*! Returns true if the QmlMetaProperty refers to a valid property, otherwise false. */ @@ -676,7 +685,7 @@ QVariant QmlMetaProperty::read() const return QVariant(); - } else if (type() & Property) { + } else if (type() & Property || type() & Attached) { return d->readValueProperty(); @@ -954,6 +963,14 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data void *a[] = { (void *)v.constData(), 0, &status, &flags}; QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); } + } else if (vt == QVariant::String) { + bool ok = false; + QVariant v = QmlStringConverters::variantFromString(value.toString(), t, &ok); + if (!ok) + return false; + + void *a[] = { (void *)v.constData(), 0, &status, &flags}; + QMetaObject::metacall(object, QMetaObject::WriteProperty, coreIdx, a); } else { return false; } @@ -970,6 +987,20 @@ bool QmlMetaProperty::write(const QVariant &value) const return write(value, 0); } +/*! + Resets the property value. +*/ +bool QmlMetaProperty::reset() const +{ + if (isResettable()) { + void *args[] = { 0 }; + QMetaObject::metacall(d->object, QMetaObject::ResetProperty, d->core.coreIndex, args); + return true; + } else { + return false; + } +} + bool QmlMetaProperty::write(const QVariant &value, QmlMetaProperty::WriteFlags flags) const { if (d->object && type() & Property && d->core.isValid() && isWritable()) @@ -1122,24 +1153,51 @@ QmlMetaPropertyPrivate::restore(const QByteArray &data, QObject *object, QmlCont Creates a QmlMetaProperty for the property \a name of \a obj. Unlike the QmlMetaProperty(QObject*, QString, QmlContext*) constructor, this static function - will correctly handle dot properties. + will correctly handle dot properties, including value types and attached properties. */ QmlMetaProperty QmlMetaProperty::createProperty(QObject *obj, const QString &name, QmlContext *context) { - QStringList path = name.split(QLatin1Char('.')); + QmlTypeNameCache *typeNameCache = context?QmlContextPrivate::get(context)->imports:0; + QStringList path = name.split(QLatin1Char('.')); QObject *object = obj; for (int jj = 0; jj < path.count() - 1; ++jj) { const QString &pathName = path.at(jj); + + if (QmlTypeNameCache::Data *data = typeNameCache?typeNameCache->data(pathName):0) { + if (data->type) { + QmlAttachedPropertiesFunc func = data->type->attachedPropertiesFunction(); + if (!func) + return QmlMetaProperty(); + object = qmlAttachedPropertiesObjectById(data->type->index(), object); + if (!object) + return QmlMetaProperty(); + continue; + } else { + Q_ASSERT(data->typeNamespace); + ++jj; + data = data->typeNamespace->data(path.at(jj)); + if (!data || !data->type) + return QmlMetaProperty(); + QmlAttachedPropertiesFunc func = data->type->attachedPropertiesFunction(); + if (!func) + return QmlMetaProperty(); + object = qmlAttachedPropertiesObjectById(data->type->index(), object); + if (!object) + return QmlMetaProperty(); + continue; + } + } + QmlMetaProperty prop(object, pathName, context); - if (jj == path.count() - 2 && - prop.propertyType() < (int)QVariant::UserType && + if (jj == path.count() - 2 && prop.propertyType() < (int)QVariant::UserType && qmlValueTypes()->valueTypes[prop.propertyType()]) { - // We're now at a value type property + // We're now at a value type property. We can use a global valuetypes array as we + // never actually use the objects, just look up their properties. QObject *typeObject = qmlValueTypes()->valueTypes[prop.propertyType()]; int idx = typeObject->metaObject()->indexOfProperty(path.last().toUtf8().constData()); diff --git a/src/declarative/qml/qmlmetaproperty.h b/src/declarative/qml/qmlmetaproperty.h index dcb5905..240f5a2 100644 --- a/src/declarative/qml/qmlmetaproperty.h +++ b/src/declarative/qml/qmlmetaproperty.h @@ -88,6 +88,7 @@ public: enum WriteFlag { BypassInterceptor = 0x01, DontRemoveBinding = 0x02 }; Q_DECLARE_FLAGS(WriteFlags, WriteFlag) bool write(const QVariant &, QmlMetaProperty::WriteFlags) const; + bool reset() const; bool hasChangedNotifier() const; bool needsChangedNotifier() const; @@ -108,6 +109,7 @@ public: bool isDefault() const; bool isWritable() const; bool isDesignable() const; + bool isResettable() const; bool isValid() const; QObject *object() const; diff --git a/src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp b/src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp new file mode 100644 index 0000000..6ae20de --- /dev/null +++ b/src/declarative/qml/qmlnetworkaccessmanagerfactory.cpp @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qmlnetworkaccessmanagerfactory.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QmlNetworkAccessManagerFactory + \brief The QmlNetworkAccessManagerFactory class provides a factory for QNetworkAccessManager + + QNetworkAccessManager is used for all network access by QML. + By implementing a factory it is possible to create custom + QNetworkAccessManager with specialized caching, proxy and + cookie support. + + To implement a factory, subclass QmlNetworkAccessManagerFactory and implement + the create() method. + + If the created QNetworkAccessManager becomes invalid, due to a + change in proxy settings, for example, call the invalidate() method. + This will cause all QNetworkAccessManagers to be recreated. + + Note: the create() method may be called by multiple threads, so ensure the + implementation of this method is reentrant. +*/ +QmlNetworkAccessManagerFactory::~QmlNetworkAccessManagerFactory() +{ +} + +/*! + \fn QNetworkAccessManager *QmlNetworkAccessManagerFactory::create(QObject *parent) + + Implement this method to create a QNetworkAccessManager with \a parent. + This allows proxies, caching and cookie support to be setup appropriately. + + Note: this method may be called by multiple threads, so ensure the + implementation of this method is reentrant. +*/ + +/*! + Invalidates all currently created QNetworkAccessManager(s) which + will cause create() to be called for subsequent network access. +*/ +void QmlNetworkAccessManagerFactory::invalidate() +{ + emit invalidated(); +} + +/*! + \internal + \fn QmlNetworkAccessManagerFactory::invalidated() +*/ + +QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlnetworkaccessmanagerfactory.h b/src/declarative/qml/qmlnetworkaccessmanagerfactory.h new file mode 100644 index 0000000..f64918b --- /dev/null +++ b/src/declarative/qml/qmlnetworkaccessmanagerfactory.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLNETWORKACCESSMANAGERFACTORY_H +#define QMLNETWORKACCESSMANAGERFACTORY_H + +#include <QtCore/qobject.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QNetworkAccessManager; +class Q_DECLARATIVE_EXPORT QmlNetworkAccessManagerFactory : public QObject +{ + Q_OBJECT +public: + virtual ~QmlNetworkAccessManagerFactory(); + void invalidate(); + virtual QNetworkAccessManager *create(QObject *parent) = 0; + +Q_SIGNALS: + void invalidated(); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QMLNETWORKACCESSMANAGERFACTORY_H diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp index fbd123a..5fd76c6 100644 --- a/src/declarative/qml/qmlobjectscriptclass.cpp +++ b/src/declarative/qml/qmlobjectscriptclass.cpp @@ -51,6 +51,9 @@ #include "qmlvmemetaobject_p.h" #include <QtCore/qtimer.h> +#include <QtCore/qvarlengtharray.h> + +Q_DECLARE_METATYPE(QScriptValue); QT_BEGIN_NAMESPACE @@ -66,8 +69,11 @@ struct ObjectData : public QScriptDeclarativeClass::Object { QtScript for QML. */ QmlObjectScriptClass::QmlObjectScriptClass(QmlEngine *bindEngine) -: QScriptDeclarativeClass(QmlEnginePrivate::getScriptEngine(bindEngine)), lastData(0), - engine(bindEngine) +: QmlScriptClass(QmlEnginePrivate::getScriptEngine(bindEngine)), +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) + methods(bindEngine), +#endif + lastData(0), engine(bindEngine) { QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); @@ -159,23 +165,25 @@ QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name, if (lastData) return QScriptClass::HandlesReadAccess | QScriptClass::HandlesWriteAccess; - if (!evalContext && context()) { - // Global object, QScriptContext activation object, QmlContext object - QScriptValue scopeNode = scopeChainValue(context(), -3); - Q_ASSERT(scopeNode.isValid()); - Q_ASSERT(scriptClass(scopeNode) == enginePrivate->contextClass); + if (!(hints & SkipAttachedProperties)) { + if (!evalContext && context()) { + // Global object, QScriptContext activation object, QmlContext object + QScriptValue scopeNode = scopeChainValue(context(), -3); + Q_ASSERT(scopeNode.isValid()); + Q_ASSERT(scriptClass(scopeNode) == enginePrivate->contextClass); - evalContext = enginePrivate->contextClass->contextFromValue(scopeNode); - } + evalContext = enginePrivate->contextClass->contextFromValue(scopeNode); + } - if (evalContext) { - QmlContextPrivate *cp = QmlContextPrivate::get(evalContext); + if (evalContext) { + QmlContextPrivate *cp = QmlContextPrivate::get(evalContext); - if (cp->imports) { - QmlTypeNameCache::Data *data = cp->imports->data(name); - if (data) { - lastTNData = data; - return QScriptClass::HandlesReadAccess; + if (cp->imports) { + QmlTypeNameCache::Data *data = cp->imports->data(name); + if (data) { + lastTNData = data; + return QScriptClass::HandlesReadAccess; + } } } } @@ -189,42 +197,49 @@ QmlObjectScriptClass::queryProperty(QObject *obj, const Identifier &name, return 0; } -QmlObjectScriptClass::Value +QmlObjectScriptClass::ScriptValue QmlObjectScriptClass::property(Object *object, const Identifier &name) { return property(toQObject(object), name); } -QmlObjectScriptClass::Value +QmlObjectScriptClass::ScriptValue QmlObjectScriptClass::property(QObject *obj, const Identifier &name) { + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); + if (name == m_destroyId.identifier) - return m_destroy; + return Value(scriptEngine, m_destroy); else if (name == m_toStringId.identifier) - return m_toString; + return Value(scriptEngine, m_toString); if (lastData && !lastData->isValid()) - return QmlEnginePrivate::getScriptEngine(engine)->undefinedValue(); + return Value(); Q_ASSERT(obj); - QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QmlEnginePrivate *enginePriv = QmlEnginePrivate::get(engine); if (lastTNData) { if (lastTNData->type) - return enginePriv->typeNameClass->newObject(obj, lastTNData->type); + return Value(scriptEngine, enginePriv->typeNameClass->newObject(obj, lastTNData->type)); else - return enginePriv->typeNameClass->newObject(obj, lastTNData->typeNamespace); + return Value(scriptEngine, enginePriv->typeNameClass->newObject(obj, lastTNData->typeNamespace)); } else if (lastData->flags & QmlPropertyCache::Data::IsFunction) { if (lastData->flags & QmlPropertyCache::Data::IsVMEFunction) { - return ((QmlVMEMetaObject *)(obj->metaObject()))->vmeMethod(lastData->coreIndex); + return Value(scriptEngine, ((QmlVMEMetaObject *)(obj->metaObject()))->vmeMethod(lastData->coreIndex)); } else { - // ### Optimize +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) + // Uncomment to use QtScript method call logic + // QScriptValue sobj = scriptEngine->newQObject(obj); + // return Value(scriptEngine, sobj.property(toString(name))); + return Value(scriptEngine, methods.newMethod(obj, lastData)); +#else QScriptValue sobj = scriptEngine->newQObject(obj); - return sobj.property(toString(name)); + return Value(scriptEngine, sobj.property(toString(name))); +#endif } } else { if (enginePriv->captureProperties && !(lastData->flags & QmlPropertyCache::Data::IsConstant)) { @@ -235,25 +250,23 @@ QmlObjectScriptClass::property(QObject *obj, const Identifier &name) if ((uint)lastData->propType < QVariant::UserType) { QmlValueType *valueType = enginePriv->valueTypes[lastData->propType]; if (valueType) - return enginePriv->valueTypeClass->newObject(obj, lastData->coreIndex, valueType); + return Value(scriptEngine, enginePriv->valueTypeClass->newObject(obj, lastData->coreIndex, valueType)); } if (lastData->flags & QmlPropertyCache::Data::IsQList) { - return enginePriv->listClass->newList(obj, lastData->coreIndex, - QmlListScriptClass::QListPtr); + return Value(scriptEngine, enginePriv->listClass->newList(obj, lastData->coreIndex, QmlListScriptClass::QListPtr, lastData->propType)); } else if (lastData->flags & QmlPropertyCache::Data::IsQmlList) { - return enginePriv->listClass->newList(obj, lastData->coreIndex, - QmlListScriptClass::QmlListPtr); + return Value(scriptEngine, enginePriv->listClass->newList(obj, lastData->coreIndex, QmlListScriptClass::QmlListPtr, lastData->propType)); } else if (lastData->flags & QmlPropertyCache::Data::IsQObjectDerived) { QObject *rv = 0; void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return newQObject(rv, lastData->propType); + return Value(scriptEngine, newQObject(rv, lastData->propType)); } else if (lastData->flags & QmlPropertyCache::Data::IsQScriptValue) { QScriptValue rv = scriptEngine->nullValue(); void *args[] = { &rv, 0 }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args); - return rv; + return Value(scriptEngine, rv); } else if (lastData->propType == QMetaType::QReal) { qreal rv = 0; void *args[] = { &rv, 0 }; @@ -291,7 +304,7 @@ QmlObjectScriptClass::property(QObject *obj, const Identifier &name) return Value(scriptEngine, rv); } else { QVariant var = obj->metaObject()->property(lastData->coreIndex).read(obj); - return enginePriv->scriptValueFromVariant(var); + return Value(scriptEngine, enginePriv->scriptValueFromVariant(var)); } } @@ -341,12 +354,18 @@ void QmlObjectScriptClass::setProperty(QObject *obj, evalContext = enginePriv->contextClass->contextFromValue(scopeNode); } - // ### Can well known types be optimized? - QVariant v = QmlScriptClass::toVariant(engine, value); QmlAbstractBinding *delBinding = QmlMetaPropertyPrivate::setBinding(obj, *lastData, 0); if (delBinding) delBinding->destroy(); - QmlMetaPropertyPrivate::write(obj, *lastData, v, evalContext); + + if (value.isUndefined() && lastData->flags & QmlPropertyCache::Data::IsResettable) { + void *a[] = { 0 }; + QMetaObject::metacall(obj, QMetaObject::ResetProperty, lastData->coreIndex, a); + } else { + // ### Can well known types be optimized? + QVariant v = QmlScriptClass::toVariant(engine, value); + QmlMetaPropertyPrivate::write(obj, *lastData, v, evalContext); + } } bool QmlObjectScriptClass::isQObject() const @@ -425,5 +444,246 @@ QStringList QmlObjectScriptClass::propertyNames(Object *object) return cache->propertyNames(); } +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) + +struct MethodData : public QScriptDeclarativeClass::Object { + MethodData(QObject *o, const QmlPropertyCache::Data &d) : object(o), data(d) {} + + QmlGuard<QObject> object; + QmlPropertyCache::Data data; +}; + +QmlObjectMethodScriptClass::QmlObjectMethodScriptClass(QmlEngine *bindEngine) +: QScriptDeclarativeClass(QmlEnginePrivate::getScriptEngine(bindEngine)), + engine(bindEngine) +{ + setSupportsCall(true); +} + +QmlObjectMethodScriptClass::~QmlObjectMethodScriptClass() +{ +} + +QScriptValue QmlObjectMethodScriptClass::newMethod(QObject *object, const QmlPropertyCache::Data *method) +{ + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); + + return newObject(scriptEngine, this, new MethodData(object, *method)); +} + +namespace { +struct MetaCallArgument { + inline MetaCallArgument(); + inline ~MetaCallArgument(); + inline void *dataPtr(); + + inline void initAsType(int type, QmlEngine *); + void fromScriptValue(int type, QmlEngine *, const QScriptValue &); + inline QScriptDeclarativeClass::Value toValue(QmlEngine *); + +private: + MetaCallArgument(const MetaCallArgument &); + + inline void cleanup(); + + char *data[16]; + int type; +}; +} + +MetaCallArgument::MetaCallArgument() +: type(QVariant::Invalid) +{ +} + +MetaCallArgument::~MetaCallArgument() +{ + cleanup(); +} + +void MetaCallArgument::cleanup() +{ + if (type == QMetaType::QString) { + ((QString *)data)->~QString(); + } else if (type == -1 || type == qMetaTypeId<QVariant>()) { + ((QVariant *)data)->~QVariant(); + } else if (type == qMetaTypeId<QScriptValue>()) { + ((QScriptValue *)data)->~QScriptValue(); + } +} + +void *MetaCallArgument::dataPtr() +{ + if (type == -1) + return ((QVariant *)data)->data(); + else + return (void *)data; +} + +void MetaCallArgument::initAsType(int callType, QmlEngine *e) +{ + if (type != 0) { cleanup(); type = 0; } + if (callType == 0) return; + + QScriptEngine *engine = QmlEnginePrivate::getScriptEngine(e); + + if (callType == qMetaTypeId<QScriptValue>()) { + new (data) QScriptValue(engine->undefinedValue()); + type = callType; + } else if (callType == QMetaType::Int || + callType == QMetaType::UInt || + callType == QMetaType::Bool || + callType == QMetaType::Double || + callType == QMetaType::Float) { + type = callType; + } else if (callType == QMetaType::QObjectStar) { + *((QObject **)data) = 0; + type = callType; + } else if (callType == QMetaType::QString) { + new (data) QString(); + type = callType; + } else if (callType == qMetaTypeId<QVariant>()) { + type = qMetaTypeId<QVariant>(); + new (data) QVariant(); + } else { + type = -1; + new (data) QVariant(callType, (void *)0); + } +} + +void MetaCallArgument::fromScriptValue(int callType, QmlEngine *engine, const QScriptValue &value) +{ + if (type != 0) { cleanup(); type = 0; } + + if (callType == qMetaTypeId<QScriptValue>()) { + new (data) QScriptValue(value); + type = qMetaTypeId<QScriptValue>(); + } else if (callType == QMetaType::Int) { + *((int *)data) = int(value.toInt32()); + type = callType; + } else if (callType == QMetaType::UInt) { + *((uint *)data) = uint(value.toUInt32()); + type = callType; + } else if (callType == QMetaType::Bool) { + *((bool *)data) = value.toBool(); + type = callType; + } else if (callType == QMetaType::Double) { + *((double *)data) = double(value.toNumber()); + type = callType; + } else if (callType == QMetaType::Float) { + *((float *)data) = float(value.toNumber()); + type = callType; + } else if (callType == QMetaType::QString) { + if (value.isNull() || value.isUndefined()) + new (data) QString(); + else + new (data) QString(value.toString()); + type = callType; + } else if (callType == QMetaType::QObjectStar) { + *((QObject **)data) = value.toQObject(); + type = callType; + } else if (callType == qMetaTypeId<QVariant>()) { + new (data) QVariant(QmlScriptClass::toVariant(engine, value)); + type = callType; + } else { + new (data) QVariant(); + type = -1; + + QVariant v = QmlScriptClass::toVariant(engine, value); + if (v.userType() == callType) { + *((QVariant *)data) = v; + } else if (v.canConvert((QVariant::Type)callType)) { + *((QVariant *)data) = v; + ((QVariant *)data)->convert((QVariant::Type)callType); + } else { + *((QVariant *)data) = QVariant(callType, (void *)0); + } + } +} + +QScriptDeclarativeClass::Value MetaCallArgument::toValue(QmlEngine *e) +{ + QScriptEngine *engine = QmlEnginePrivate::getScriptEngine(e); + + if (type == qMetaTypeId<QScriptValue>()) { + return QScriptDeclarativeClass::Value(engine, *((QScriptValue *)data)); + } else if (type == QMetaType::Int) { + return QScriptDeclarativeClass::Value(engine, *((int *)data)); + } else if (type == QMetaType::UInt) { + return QScriptDeclarativeClass::Value(engine, *((uint *)data)); + } else if (type == QMetaType::Bool) { + return QScriptDeclarativeClass::Value(engine, *((bool *)data)); + } else if (type == QMetaType::Double) { + return QScriptDeclarativeClass::Value(engine, *((double *)data)); + } else if (type == QMetaType::Float) { + return QScriptDeclarativeClass::Value(engine, *((float *)data)); + } else if (type == QMetaType::QString) { + return QScriptDeclarativeClass::Value(engine, *((QString *)data)); + } else if (type == QMetaType::QObjectStar) { + return QScriptDeclarativeClass::Value(engine, QmlEnginePrivate::get(e)->objectClass->newQObject(*((QObject **)data))); + } else if (type == -1 || type == qMetaTypeId<QVariant>()) { + return QScriptDeclarativeClass::Value(engine, QmlEnginePrivate::get(e)->scriptValueFromVariant(*((QVariant *)data))); + } else { + return QScriptDeclarativeClass::Value(); + } +} + +QmlObjectMethodScriptClass::Value QmlObjectMethodScriptClass::call(Object *o, QScriptContext *ctxt) +{ + MethodData *method = static_cast<MethodData *>(o); + + if (method->data.flags & QmlPropertyCache::Data::HasArguments) { + + QMetaMethod m = method->object->metaObject()->method(method->data.coreIndex); + QList<QByteArray> argTypeNames = m.parameterTypes(); + QVarLengthArray<int, 9> argTypes(argTypeNames.count()); + + // ### Cache + for (int ii = 0; ii < argTypeNames.count(); ++ii) { + argTypes[ii] = QMetaType::type(argTypeNames.at(ii)); + if (argTypes[ii] == QVariant::Invalid) + return Value(ctxt, ctxt->throwError(QString(QLatin1String("Unknown method parameter type: %1")).arg(QLatin1String(argTypeNames.at(ii))))); + } + + if (argTypes.count() > ctxt->argumentCount()) + return Value(ctxt, ctxt->throwError("Insufficient arguments")); + + QVarLengthArray<MetaCallArgument, 9> args(argTypes.count() + 1); + args[0].initAsType(method->data.propType, engine); + + for (int ii = 0; ii < argTypes.count(); ++ii) + args[ii + 1].fromScriptValue(argTypes[ii], engine, ctxt->argument(ii)); + + QVarLengthArray<void *, 9> argData(args.count()); + for (int ii = 0; ii < args.count(); ++ii) + argData[ii] = args[ii].dataPtr(); + + QMetaObject::metacall(method->object, QMetaObject::InvokeMetaMethod, method->data.coreIndex, argData.data()); + + return args[0].toValue(engine); + + } else if (method->data.propType != 0) { + + MetaCallArgument arg; + arg.initAsType(method->data.propType, engine); + + void *args[] = { arg.dataPtr() }; + + QMetaObject::metacall(method->object, QMetaObject::InvokeMetaMethod, method->data.coreIndex, args); + + return arg.toValue(engine); + + } else { + + void *args[] = { 0 }; + QMetaObject::metacall(method->object, QMetaObject::InvokeMetaMethod, method->data.coreIndex, args); + return Value(); + + } + return Value(); +} + +#endif + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlobjectscriptclass_p.h b/src/declarative/qml/qmlobjectscriptclass_p.h index 457eb2b..ebb2c2a 100644 --- a/src/declarative/qml/qmlobjectscriptclass_p.h +++ b/src/declarative/qml/qmlobjectscriptclass_p.h @@ -56,9 +56,7 @@ #include "qmlpropertycache_p.h" #include "qmltypenamecache_p.h" -#include <QtScript/qscriptclass.h> - -#include <private/qscriptdeclarativeclass_p.h> +#include <private/qmlscriptclass_p.h> QT_BEGIN_NAMESPACE @@ -66,7 +64,24 @@ class QmlEngine; class QScriptContext; class QScriptEngine; class QmlContext; -class Q_AUTOTEST_EXPORT QmlObjectScriptClass : public QScriptDeclarativeClass + +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) +class Q_AUTOTEST_EXPORT QmlObjectMethodScriptClass : public QScriptDeclarativeClass +{ +public: + QmlObjectMethodScriptClass(QmlEngine *); + ~QmlObjectMethodScriptClass(); + + QScriptValue newMethod(QObject *, const QmlPropertyCache::Data *); +protected: + virtual Value call(Object *, QScriptContext *); + +private: + QmlEngine *engine; +}; +#endif + +class Q_AUTOTEST_EXPORT QmlObjectScriptClass : public QmlScriptClass { public: QmlObjectScriptClass(QmlEngine *); @@ -86,7 +101,9 @@ public: QScriptClass::QueryFlags flags, QmlContext *evalContext, QueryHints hints = 0); - Value property(QObject *, const Identifier &); + + ScriptValue property(QObject *, const Identifier &); + void setProperty(QObject *, const Identifier &name, const QScriptValue &, QmlContext *evalContext = 0); virtual QStringList propertyNames(Object *); @@ -95,12 +112,16 @@ protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual Value property(Object *, const Identifier &); + virtual ScriptValue property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); virtual bool isQObject() const; virtual QObject *toQObject(Object *, bool *ok = 0); private: +#if (QT_VERSION >= QT_VERSION_CHECK(4, 6, 2)) + QmlObjectMethodScriptClass methods; +#endif + QmlTypeNameCache::Data *lastTNData; QmlPropertyCache::Data *lastData; QmlPropertyCache::Data local; @@ -115,6 +136,7 @@ private: QmlEngine *engine; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QmlObjectScriptClass::QueryHints); QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 3bbf1fe..51753b8 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -61,6 +61,8 @@ void QmlPropertyCache::Data::load(const QMetaProperty &p, QmlEngine *engine) flags |= Data::IsConstant; if (p.isWritable()) flags |= Data::IsWritable; + if (p.isResettable()) + flags |= Data::IsResettable; if (propType == qMetaTypeId<QmlBinding *>()) { flags |= Data::IsQmlBinding; @@ -84,6 +86,15 @@ void QmlPropertyCache::Data::load(const QMetaMethod &m) { coreIndex = m.methodIndex(); flags |= Data::IsFunction; + propType = QVariant::Invalid; + + const char *returnType = m.typeName(); + if (returnType) + propType = QMetaType::type(returnType); + + QList<QByteArray> params = m.parameterTypes(); + if (!params.isEmpty()) + flags |= Data::HasArguments; } diff --git a/src/declarative/qml/qmlpropertycache_p.h b/src/declarative/qml/qmlpropertycache_p.h index a94b2a1..8d54e35 100644 --- a/src/declarative/qml/qmlpropertycache_p.h +++ b/src/declarative/qml/qmlpropertycache_p.h @@ -80,16 +80,21 @@ public: // Can apply to all properties, except IsFunction IsConstant = 0x00000001, IsWritable = 0x00000002, + IsResettable = 0x00000004, - // These are mutually exclusive - IsFunction = 0x00000004, - IsVMEFunction = 0x00000008, + // These are mutualy exclusive + IsFunction = 0x00000008, IsQObjectDerived = 0x00000010, IsEnumType = 0x00000020, IsQmlList = 0x00000040, IsQList = 0x00000080, IsQmlBinding = 0x00000100, - IsQScriptValue = 0x00000200 + IsQScriptValue = 0x00000200, + + // Apply only to IsFunctions + IsVMEFunction = 0x00000400, + HasArguments = 0x00000800 + }; Q_DECLARE_FLAGS(Flags, Flag) diff --git a/src/declarative/qml/qmlbindingvme_p.h b/src/declarative/qml/qmlscriptclass_p.h index 4ef7d04..7ffb2ae 100644 --- a/src/declarative/qml/qmlbindingvme_p.h +++ b/src/declarative/qml/qmlscriptclass_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QMLBINDINGVME_P_H -#define QMLBINDINGVME_P_H +#ifndef QMLSCRIPTCLASS_P_H +#define QMLSCRIPTCLASS_P_H // // W A R N I N G @@ -53,65 +53,37 @@ // We mean it. // -#include <QtCore/qglobal.h> -#include <private/qmlbasicscript_p.h> +#include <QtScript/qscriptclass.h> #include <private/qscriptdeclarativeclass_p.h> -#include "qmlguard_p.h" - -QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QObject; -class QmlContextPrivate; -class QmlBindingVME +class QmlEngine; +class QmlScriptClass : public QScriptDeclarativeClass { public: - struct Config { - Config() : target(0), targetSlot(-1), subscriptions(0), identifiers(0) {} - ~Config() { delete [] subscriptions; delete [] identifiers; } - QObject *target; - int targetSlot; - - struct Subscription { - QmlGuard<QObject> source; - int notifyIndex; - }; - Subscription *subscriptions; - QScriptDeclarativeClass::PersistentIdentifier *identifiers; + QmlScriptClass(QScriptEngine *); + + static QVariant toVariant(QmlEngine *, const QScriptValue &); + +#if (QT_VERSION < QT_VERSION_CHECK(4, 6, 2)) + struct Value : public QScriptValue { + Value() : QScriptValue() {} + Value(QScriptEngine *engine, int v) : QScriptValue(engine, v) {} + Value(QScriptEngine *engine, uint v) : QScriptValue(engine, v) {} + Value(QScriptEngine *engine, bool v) : QScriptValue(engine, v) {} + Value(QScriptEngine *engine, double v) : QScriptValue(engine, v) {} + Value(QScriptEngine *engine, float v) : QScriptValue(engine, v) {} + Value(QScriptEngine *engine, const QString &v) : QScriptValue(engine, v) {} + Value(QScriptEngine *, const QScriptValue &v) : QScriptValue(v) {} }; - static void init(const char *program, Config *config, - quint32 **sigTable, quint32 *bindingCount); - static void run(const char *program, int instr, - Config *config, QmlContextPrivate *context, - QObject **scopes, QObject **outputs); - static void dump(const char *); -}; - -class QmlBindingCompilerPrivate; -class QmlBindingCompiler -{ -public: - QmlBindingCompiler(); - ~QmlBindingCompiler(); - - // Returns true if bindings were compiled - bool isValid() const; - - // -1 on failure, otherwise the binding index to use - int compile(const QmlBasicScript::Expression &, QmlEnginePrivate *); - - // Returns the compiled program - QByteArray program() const; - -private: - QmlBindingCompilerPrivate *d; + typedef QScriptValue ScriptValue; +#else + typedef Value ScriptValue; +#endif }; QT_END_NAMESPACE -QT_END_HEADER - -#endif // QMLBINDINGVME_P_H - +#endif // QMLSCRIPTCLASS_P_H diff --git a/src/declarative/qml/qmlstringconverters.cpp b/src/declarative/qml/qmlstringconverters.cpp index c68654f..2963ab5 100644 --- a/src/declarative/qml/qmlstringconverters.cpp +++ b/src/declarative/qml/qmlstringconverters.cpp @@ -47,6 +47,7 @@ #include <QtCore/qrect.h> #include <QtCore/qsize.h> #include <QtCore/qvariant.h> +#include <QtCore/qdatetime.h> QT_BEGIN_NAMESPACE @@ -94,14 +95,43 @@ QVariant QmlStringConverters::variantFromString(const QString &s) if (ok) return QVariant(p); QSizeF sz = sizeFFromString(s, &ok); if (ok) return QVariant(sz); - bool b = boolFromString(s, &ok); - if (ok) return QVariant(b); QVector3D v = vector3DFromString(s, &ok); if (ok) return qVariantFromValue(v); return QVariant(s); } +QVariant QmlStringConverters::variantFromString(const QString &s, int preferredType, bool *ok) +{ + switch (preferredType) { + case QMetaType::QColor: + return QVariant::fromValue(colorFromString(s, ok)); + case QMetaType::QDate: + return QVariant::fromValue(dateFromString(s, ok)); + case QMetaType::QTime: + return QVariant::fromValue(timeFromString(s, ok)); + case QMetaType::QDateTime: + return QVariant::fromValue(dateTimeFromString(s, ok)); + case QMetaType::QPointF: + return QVariant::fromValue(pointFFromString(s, ok)); + case QMetaType::QPoint: + return QVariant::fromValue(pointFFromString(s, ok).toPoint()); + case QMetaType::QSizeF: + return QVariant::fromValue(sizeFFromString(s, ok)); + case QMetaType::QSize: + return QVariant::fromValue(sizeFFromString(s, ok).toSize()); + case QMetaType::QRectF: + return QVariant::fromValue(rectFFromString(s, ok)); + case QMetaType::QRect: + return QVariant::fromValue(rectFFromString(s, ok).toRect()); + case QMetaType::QVector3D: + return QVariant::fromValue(vector3DFromString(s, ok)); + default: + if (ok) *ok = false; + return QVariant(); + } +} + QColor QmlStringConverters::colorFromString(const QString &s, bool *ok) { if (s.startsWith(QLatin1Char('#')) && s.length() == 9) { @@ -120,6 +150,27 @@ QColor QmlStringConverters::colorFromString(const QString &s, bool *ok) } } +QDate QmlStringConverters::dateFromString(const QString &s, bool *ok) +{ + QDate d = QDate::fromString(s, Qt::ISODate); + if (ok) *ok = d.isValid(); + return d; +} + +QTime QmlStringConverters::timeFromString(const QString &s, bool *ok) +{ + QTime t = QTime::fromString(s, Qt::ISODate); + if (ok) *ok = t.isValid(); + return t; +} + +QDateTime QmlStringConverters::dateTimeFromString(const QString &s, bool *ok) +{ + QDateTime d = QDateTime::fromString(s, Qt::ISODate); + if (ok) *ok = d.isValid(); + return d; +} + //expects input of "x,y" QPointF QmlStringConverters::pointFFromString(const QString &s, bool *ok) { @@ -196,23 +247,6 @@ QRectF QmlStringConverters::rectFFromString(const QString &s, bool *ok) return QRectF(x, y, width, height); } -bool QmlStringConverters::boolFromString(const QString &str, bool *ok) -{ - if (str.isEmpty() || str == QLatin1String("false") || str == QLatin1String("0")) { - if (ok) - *ok = true; - return false; - } else if (str == QLatin1String("true") || str == QLatin1String("1")) { - if (ok) - *ok = true; - return true; - } - - if (ok) - *ok = false; - return true; -} - //expects input of "x,y,z" QVector3D QmlStringConverters::vector3DFromString(const QString &s, bool *ok) { diff --git a/src/declarative/qml/qmlstringconverters_p.h b/src/declarative/qml/qmlstringconverters_p.h index 380a904..dfc59ce 100644 --- a/src/declarative/qml/qmlstringconverters_p.h +++ b/src/declarative/qml/qmlstringconverters_p.h @@ -70,11 +70,15 @@ QT_BEGIN_NAMESPACE namespace QmlStringConverters { QVariant Q_DECLARATIVE_EXPORT variantFromString(const QString &); + QVariant Q_DECLARATIVE_EXPORT variantFromString(const QString &, int preferredType, bool *ok = 0); + QColor Q_DECLARATIVE_EXPORT colorFromString(const QString &, bool *ok = 0); + QDate Q_DECLARATIVE_EXPORT dateFromString(const QString &, bool *ok = 0); + QTime Q_DECLARATIVE_EXPORT timeFromString(const QString &, bool *ok = 0); + QDateTime Q_DECLARATIVE_EXPORT dateTimeFromString(const QString &, bool *ok = 0); QPointF Q_DECLARATIVE_EXPORT pointFFromString(const QString &, bool *ok = 0); QSizeF Q_DECLARATIVE_EXPORT sizeFFromString(const QString &, bool *ok = 0); QRectF Q_DECLARATIVE_EXPORT rectFFromString(const QString &, bool *ok = 0); - bool Q_DECLARATIVE_EXPORT boolFromString(const QString &, bool *ok = 0); QVector3D Q_DECLARATIVE_EXPORT vector3DFromString(const QString &, bool *ok = 0); }; diff --git a/src/declarative/qml/qmltypenamescriptclass.cpp b/src/declarative/qml/qmltypenamescriptclass.cpp index 3e4b08c..14c8652 100644 --- a/src/declarative/qml/qmltypenamescriptclass.cpp +++ b/src/declarative/qml/qmltypenamescriptclass.cpp @@ -62,7 +62,7 @@ struct TypeNameData : public QScriptDeclarativeClass::Object { }; QmlTypeNameScriptClass::QmlTypeNameScriptClass(QmlEngine *bindEngine) -: QScriptDeclarativeClass(QmlEnginePrivate::getScriptEngine(bindEngine)), +: QmlScriptClass(QmlEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine), object(0), type(0) { } @@ -139,15 +139,17 @@ QmlTypeNameScriptClass::queryProperty(Object *obj, const Identifier &name, return 0; } -QmlTypeNameScriptClass::Value QmlTypeNameScriptClass::property(Object *obj, const Identifier &name) +QmlTypeNameScriptClass::ScriptValue +QmlTypeNameScriptClass::property(Object *obj, const Identifier &name) { QmlEnginePrivate *ep = QmlEnginePrivate::get(engine); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); if (type) { - return newObject(((TypeNameData *)obj)->object, type, ((TypeNameData *)obj)->mode); + return Value(scriptEngine, newObject(((TypeNameData *)obj)->object, type, ((TypeNameData *)obj)->mode)); } else if (object) { return ep->objectClass->property(object, name); } else { - return Value(&ep->scriptEngine, enumValue); + return Value(scriptEngine, enumValue); } } diff --git a/src/declarative/qml/qmltypenamescriptclass_p.h b/src/declarative/qml/qmltypenamescriptclass_p.h index 702930f..cf8c621 100644 --- a/src/declarative/qml/qmltypenamescriptclass_p.h +++ b/src/declarative/qml/qmltypenamescriptclass_p.h @@ -56,14 +56,14 @@ #include <QtScript/qscriptclass.h> -#include <private/qscriptdeclarativeclass_p.h> +#include <private/qmlscriptclass_p.h> QT_BEGIN_NAMESPACE class QmlEngine; class QmlType; class QmlTypeNameCache; -class QmlTypeNameScriptClass : public QScriptDeclarativeClass +class QmlTypeNameScriptClass : public QmlScriptClass { public: QmlTypeNameScriptClass(QmlEngine *); @@ -77,7 +77,7 @@ protected: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual Value property(Object *, const Identifier &); + virtual ScriptValue property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); private: diff --git a/src/declarative/qml/qmlvaluetypescriptclass.cpp b/src/declarative/qml/qmlvaluetypescriptclass.cpp index 65a63f4..5e222a1 100644 --- a/src/declarative/qml/qmlvaluetypescriptclass.cpp +++ b/src/declarative/qml/qmlvaluetypescriptclass.cpp @@ -53,7 +53,7 @@ struct QmlValueTypeReference : public QScriptDeclarativeClass::Object { }; QmlValueTypeScriptClass::QmlValueTypeScriptClass(QmlEngine *bindEngine) -: QScriptDeclarativeClass(QmlEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine) +: QmlScriptClass(QmlEnginePrivate::getScriptEngine(bindEngine)), engine(bindEngine) { } @@ -98,7 +98,7 @@ QmlValueTypeScriptClass::queryProperty(Object *obj, const Identifier &name, return rv; } -QmlValueTypeScriptClass::Value QmlValueTypeScriptClass::property(Object *obj, const Identifier &) +QmlValueTypeScriptClass::ScriptValue QmlValueTypeScriptClass::property(Object *obj, const Identifier &) { QmlValueTypeReference *ref = static_cast<QmlValueTypeReference *>(obj); @@ -106,7 +106,8 @@ QmlValueTypeScriptClass::Value QmlValueTypeScriptClass::property(Object *obj, co ref->type->read(ref->object, ref->property); QVariant rv = p.read(ref->type); - return static_cast<QmlEnginePrivate *>(QObjectPrivate::get(engine))->scriptValueFromVariant(rv); + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); + return Value(scriptEngine, static_cast<QmlEnginePrivate *>(QObjectPrivate::get(engine))->scriptValueFromVariant(rv)); } void QmlValueTypeScriptClass::setProperty(Object *obj, const Identifier &, diff --git a/src/declarative/qml/qmlvaluetypescriptclass_p.h b/src/declarative/qml/qmlvaluetypescriptclass_p.h index 9214987..09af967 100644 --- a/src/declarative/qml/qmlvaluetypescriptclass_p.h +++ b/src/declarative/qml/qmlvaluetypescriptclass_p.h @@ -52,15 +52,15 @@ // // We mean it. // -#include <QtScript/qscriptclass.h> -#include <private/qscriptdeclarativeclass_p.h> + +#include <private/qmlscriptclass_p.h> QT_BEGIN_NAMESPACE class QmlEngine; class QmlValueType; -class QmlValueTypeScriptClass : public QScriptDeclarativeClass +class QmlValueTypeScriptClass : public QmlScriptClass { public: QmlValueTypeScriptClass(QmlEngine *); @@ -70,7 +70,7 @@ public: virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &, QScriptClass::QueryFlags flags); - virtual Value property(Object *, const Identifier &); + virtual ScriptValue property(Object *, const Identifier &); virtual void setProperty(Object *, const Identifier &name, const QScriptValue &); virtual QVariant toVariant(Object *, bool *ok = 0); diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 06795a8..e9a0449 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -57,7 +57,7 @@ #include "qmlvmemetaobject_p.h" #include "qmlbinding_p.h" #include "qmlcontext_p.h" -#include "qmlbindingoptimizations_p.h" +#include "qmlcompiledbindings_p.h" #include "qmlglobal_p.h" #include "qmlscriptstring.h" @@ -173,7 +173,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt, if (instr.init.contextCache != -1) cp->setIdPropertyData(comp->contextCaches.at(instr.init.contextCache)); if (instr.init.compiledBinding != -1) - cp->optimizedBindings = new QmlOptimizedBindings(datas.at(instr.init.compiledBinding).constData(), ctxt); + cp->optimizedBindings = new QmlCompiledBindings(datas.at(instr.init.compiledBinding).constData(), ctxt); } break; @@ -627,23 +627,6 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt, } break; - case QmlInstruction::StoreIdOptBinding: - { - int coreIndex = instr.assignIdOptBinding.property; - if (stack.count() == 1 && bindingSkipList.testBit(coreIndex)) - break; - - QObject *target = stack.top(); - - QmlBinding_Id *bind = - new QmlBinding_Id(target, instr.assignIdOptBinding.property, - ctxt, instr.assignIdOptBinding.id); - bindValues.append(bind); - bind->m_mePtr = &bindValues.values[bindValues.count - 1]; - bind->addToObject(target); - } - break; - case QmlInstruction::StoreValueSource: { QObject *obj = stack.pop(); diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qmlworkerscript.cpp index a0d6ef0..75c5179 100644 --- a/src/declarative/qml/qmlworkerscript.cpp +++ b/src/declarative/qml/qmlworkerscript.cpp @@ -51,6 +51,9 @@ #include <QtCore/qwaitcondition.h> #include <QtScript/qscriptvalueiterator.h> #include <QtCore/qfile.h> +#include <QtDeclarative/qmlinfo.h> + +QT_BEGIN_NAMESPACE class WorkerDataEvent : public QEvent { @@ -144,6 +147,82 @@ private: void processLoad(int, const QUrl &); }; +// Currently this will leak as no-one releases it in the worker thread +class QmlWorkerListModelAgent : public QObject +{ + Q_OBJECT + Q_PROPERTY(int count READ count); + +public: + QmlWorkerListModelAgent(QmlWorkerListModel *); + ~QmlWorkerListModelAgent(); + + void addref(); + void release(); + + int count() const; + + Q_INVOKABLE void clear(); + Q_INVOKABLE void remove(int index); + Q_INVOKABLE void append(const QScriptValue &); + Q_INVOKABLE void insert(int index, const QScriptValue&); + Q_INVOKABLE QScriptValue get(int index) const; + Q_INVOKABLE void set(int index, const QScriptValue &); + Q_INVOKABLE void sync(); + + struct VariantRef + { + VariantRef() : a(0) {} + VariantRef(const VariantRef &r) : a(r.a) { if (a) a->addref(); } + VariantRef(QmlWorkerListModelAgent *_a) : a(_a) { if (a) a->addref(); } + ~VariantRef() { if (a) a->release(); } + + VariantRef &operator=(const VariantRef &o) { + if (o.a) o.a->addref(); + if (a) a->release(); a = o.a; + return *this; + } + + QmlWorkerListModelAgent *a; + }; +protected: + virtual bool event(QEvent *); + +private: + friend class QmlWorkerScriptEnginePrivate; + friend class QmlWorkerListModel; + QScriptEngine *m_engine; + + struct Change { + enum { Inserted, Removed, Moved, Changed } type; + int index; // Inserted/Removed/Moved/Changed + int count; // Inserted/Removed/Moved/Changed + int to; // Moved + }; + + struct Data { + QHash<int, QString> roles; + QHash<QString, int> strings; + QList<QHash<int, QVariant> > values; + QList<Change> changes; + + void clearChange(); + void insertChange(int index, int count); + void removeChange(int index, int count); + void changedChange(int index, int count); + }; + Data data; + + struct Sync : public QEvent { + Sync() : QEvent(QEvent::User) {} + Data data; + }; + + QAtomicInt m_ref; + QmlWorkerListModel *m_model; +}; +Q_DECLARE_METATYPE(QmlWorkerListModelAgent::VariantRef); + QmlWorkerScriptEnginePrivate::QmlWorkerScriptEnginePrivate() : workerEngine(0), m_nextId(0) { @@ -285,6 +364,15 @@ QVariant QmlWorkerScriptEnginePrivate::scriptValueToVariant(const QScriptValue & } return QVariant(list); + } else if (value.isQObject()) { + QmlWorkerListModel *lm = qobject_cast<QmlWorkerListModel *>(value.toQObject()); + if (lm) { + QmlWorkerListModelAgent::VariantRef v(lm->agent()); + return qVariantFromValue(v); + } else { + // No other QObject's are allowed to be sent + return QVariant(); + } } else if (value.isObject()) { QVariantHash hash; @@ -310,6 +398,15 @@ QScriptValue QmlWorkerScriptEnginePrivate::variantToScriptValue(const QVariant & return QScriptValue(value.toString()); } else if (value.userType() == QMetaType::QReal) { return QScriptValue(value.toReal()); + } else if (value.userType() == qMetaTypeId<QmlWorkerListModelAgent::VariantRef>()) { + QmlWorkerListModelAgent::VariantRef vr = qvariant_cast<QmlWorkerListModelAgent::VariantRef>(value); + if (vr.a->m_engine == 0) + vr.a->m_engine = engine; + else if (vr.a->m_engine != engine) + return engine->nullValue(); + QScriptValue o = engine->newQObject(vr.a); + o.setData(engine->newVariant(value)); // Keeps the agent ref so that it is cleaned up on gc + return o; } else if (value.userType() == QMetaType::QVariantList) { QVariantList list = qvariant_cast<QVariantList>(value); QScriptValue rv = engine->newArray(list.count()); @@ -513,5 +610,411 @@ bool QmlWorkerScript::event(QEvent *event) } } - QML_DEFINE_TYPE(Qt, 4, 6, WorkerScript, QmlWorkerScript); + +void QmlWorkerListModelAgent::Data::clearChange() +{ + changes.clear(); +} + +void QmlWorkerListModelAgent::Data::insertChange(int index, int count) +{ + Change c = { Change::Inserted, index, count, 0 }; + changes << c; +} + +void QmlWorkerListModelAgent::Data::removeChange(int index, int count) +{ + Change c = { Change::Removed, index, count, 0 }; + changes << c; +} + +void QmlWorkerListModelAgent::Data::changedChange(int index, int count) +{ + Change c = { Change::Changed, index, count, 0 }; + changes << c; +} + +QmlWorkerListModelAgent::QmlWorkerListModelAgent(QmlWorkerListModel *m) +: m_engine(0), m_ref(1), m_model(m) +{ + data.roles = m_model->m_roles; + data.strings = m_model->m_strings; + data.values = m_model->m_values; +} + +QmlWorkerListModelAgent::~QmlWorkerListModelAgent() +{ +} + +void QmlWorkerListModelAgent::addref() +{ + m_ref.ref(); +} + +void QmlWorkerListModelAgent::release() +{ + bool del = !m_ref.deref(); + + if (del) + delete this; +} + +int QmlWorkerListModelAgent::count() const +{ + return data.values.count(); +} + +void QmlWorkerListModelAgent::clear() +{ + data.clearChange(); + data.removeChange(0, data.values.count()); + data.values.clear(); +} + +void QmlWorkerListModelAgent::remove(int index) +{ + if (data.values.count() <= index) + return; + + data.values.removeAt(index); + data.removeChange(index, 1); +} + +void QmlWorkerListModelAgent::append(const QScriptValue &value) +{ + QHash<int, QVariant> row; + + QScriptValueIterator it(value); + while (it.hasNext()) { + it.next(); + QString name = it.name(); + QVariant v = it.value().toVariant(); + + QHash<QString, int>::Iterator iter = data.strings.find(name); + if (iter == data.strings.end()) { + int role = data.roles.count(); + data.roles.insert(role, name); + iter = data.strings.insert(name, role); + } + row.insert(*iter, v); + } + + data.values.append(row); + data.insertChange(data.values.count() - 1, 1); +} + +void QmlWorkerListModelAgent::insert(int index, const QScriptValue &value) +{ + if (index > data.values.count()) + return; + + QHash<int, QVariant> row; + + QScriptValueIterator it(value); + while (it.hasNext()) { + it.next(); + QString name = it.name(); + QVariant v = it.value().toVariant(); + + QHash<QString, int>::Iterator iter = data.strings.find(name); + if (iter == data.strings.end()) { + int role = data.roles.count(); + data.roles.insert(role, name); + iter = data.strings.insert(name, role); + } + row.insert(*iter, v); + } + + data.values.insert(index, row); + data.insertChange(index, 1); +} + +void QmlWorkerListModelAgent::set(int index, const QScriptValue &value) +{ + if (data.values.count() <= index) + return; + + QHash<int, QVariant> row; + + QScriptValueIterator it(value); + while (it.hasNext()) { + it.next(); + QString name = it.name(); + QVariant v = it.value().toVariant(); + + QHash<QString, int>::Iterator iter = data.strings.find(name); + if (iter == data.strings.end()) { + int role = data.roles.count(); + data.roles.insert(role, name); + iter = data.strings.insert(name, role); + } + row.insert(*iter, v); + } + + if (data.values.at(index) != row) { + data.values[index] = row; + data.changedChange(index, 1); + } +} + +QScriptValue QmlWorkerListModelAgent::get(int index) const +{ + if (data.values.count() <= index) + return m_engine->undefinedValue(); + + QScriptValue rv = m_engine->newObject(); + + QHash<int, QVariant> row = data.values.at(index); + for (QHash<int, QVariant>::ConstIterator iter = row.begin(); iter != row.end(); ++iter) + rv.setProperty(data.roles.value(iter.key()), qScriptValueFromValue(m_engine, iter.value())); + + return rv; +} + +void QmlWorkerListModelAgent::sync() +{ + Sync *s = new Sync; + s->data = data; + data.changes.clear(); + QCoreApplication::postEvent(this, s); +} + +bool QmlWorkerListModelAgent::event(QEvent *e) +{ + if (e->type() == QEvent::User) { + Sync *s = static_cast<Sync *>(e); + + const QList<Change> &changes = s->data.changes; + + if (m_model) { + bool cc = m_model->m_values.count() != s->data.values.count(); + + m_model->m_roles = s->data.roles; + m_model->m_strings = s->data.strings; + m_model->m_values = s->data.values; + + for (int ii = 0; ii < changes.count(); ++ii) { + const Change &change = changes.at(ii); + switch (change.type) { + case Change::Inserted: + emit m_model->itemsInserted(change.index, change.count); + break; + case Change::Removed: + emit m_model->itemsRemoved(change.index, change.count); + break; + case Change::Moved: + emit m_model->itemsMoved(change.index, change.to, change.count); + break; + case Change::Changed: + emit m_model->itemsMoved(change.index, change.to, change.count); + break; + } + } + + if (cc) + emit m_model->countChanged(); + } + } + + return QObject::event(e); +} + +QmlWorkerListModel::QmlWorkerListModel(QObject *parent) +: QListModelInterface(parent), m_agent(0) +{ +} + +QmlWorkerListModel::~QmlWorkerListModel() +{ + if (m_agent) { + m_agent->m_model = 0; + m_agent->release(); + } +} + +void QmlWorkerListModel::clear() +{ + if (m_agent) { + qmlInfo(this) << "List can only be modified from a WorkerScript"; + return; + } + + int count = m_values.count(); + m_values.clear(); + if (count) { + emit itemsRemoved(0, count); + emit countChanged(); + } +} + +void QmlWorkerListModel::remove(int index) +{ + if (m_agent) { + qmlInfo(this) << "List can only be modified from a WorkerScript"; + return; + } + + if (m_values.count() <= index) + return; + + m_values.removeAt(index); + emit itemsRemoved(index, 1); + emit countChanged(); +} + +void QmlWorkerListModel::append(const QScriptValue &value) +{ + if (m_agent) { + qmlInfo(this) << "List can only be modified from a WorkerScript"; + return; + } + + QHash<int, QVariant> data; + + QScriptValueIterator it(value); + while (it.hasNext()) { + it.next(); + QString name = it.name(); + QVariant v = it.value().toVariant(); + + QHash<QString, int>::Iterator iter = m_strings.find(name); + if (iter == m_strings.end()) { + int role = m_roles.count(); + m_roles.insert(role, name); + iter = m_strings.insert(name, role); + } + data.insert(*iter, v); + } + + m_values.append(data); + + emit itemsInserted(m_values.count() - 1, 1); + emit countChanged(); +} + +void QmlWorkerListModel::insert(int index, const QScriptValue &value) +{ + if (m_agent) { + qmlInfo(this) << "List can only be modified from a WorkerScript"; + return; + } + + if (index > m_values.count()) + return; + + QHash<int, QVariant> data; + + QScriptValueIterator it(value); + while (it.hasNext()) { + it.next(); + QString name = it.name(); + QVariant v = it.value().toVariant(); + + QHash<QString, int>::Iterator iter = m_strings.find(name); + if (iter == m_strings.end()) { + int role = m_roles.count(); + m_roles.insert(role, name); + iter = m_strings.insert(name, role); + } + data.insert(*iter, v); + } + + m_values.insert(index, data); + emit itemsInserted(index, 1); + emit countChanged(); +} + +QScriptValue QmlWorkerListModel::get(int index) const +{ + QmlEngine *engine = qmlEngine(this); + if (!engine || m_values.count() <= index) + return QScriptValue(); + + QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); + QScriptValue rv = scriptEngine->newObject(); + + QHash<int, QVariant> data = m_values.at(index); + for (QHash<int, QVariant>::ConstIterator iter = data.begin(); iter != data.end(); ++iter) + rv.setProperty(m_roles.value(iter.key()), qScriptValueFromValue(scriptEngine, iter.value())); + + return rv; +} + +void QmlWorkerListModel::set(int index, const QScriptValue &value) +{ + if (m_agent) { + qmlInfo(this) << "List can only be modified from a WorkerScript"; + return; + } + + if (m_values.count() <= index) + return; + + QHash<int, QVariant> data; + + QScriptValueIterator it(value); + while (it.hasNext()) { + it.next(); + QString name = it.name(); + QVariant v = it.value().toVariant(); + + QHash<QString, int>::Iterator iter = m_strings.find(name); + if (iter == m_strings.end()) { + int role = m_roles.count(); + m_roles.insert(role, name); + iter = m_strings.insert(name, role); + } + data.insert(*iter, v); + } + + if (m_values.at(index) != data) { + m_values[index] = data; + emit itemsChanged(index, 1, m_roles.keys()); + } +} + +QmlWorkerListModelAgent *QmlWorkerListModel::agent() +{ + if (!m_agent) + m_agent = new QmlWorkerListModelAgent(this); + + return m_agent; +} + +QList<int> QmlWorkerListModel::roles() const +{ + return m_roles.keys(); +} + +QString QmlWorkerListModel::toString(int role) const +{ + return m_roles.value(role); +} + +int QmlWorkerListModel::count() const +{ + return m_values.count(); +} + +QHash<int,QVariant> QmlWorkerListModel::data(int index, const QList<int> &) const +{ + if (m_values.count() <= index) + return QHash<int, QVariant>(); + else + return m_values.at(index); +} + +QVariant QmlWorkerListModel::data(int index, int role) const +{ + if (m_values.count() <= index) + return QVariant(); + else + return m_values.at(index).value(role); +} + +QML_DEFINE_TYPE(Qt,4,6,WorkerListModel,QmlWorkerListModel) + +#include "qmlworkerscript.moc" + +QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlworkerscript_p.h b/src/declarative/qml/qmlworkerscript_p.h index 1ec7af3..f0ef7c9 100644 --- a/src/declarative/qml/qmlworkerscript_p.h +++ b/src/declarative/qml/qmlworkerscript_p.h @@ -55,11 +55,14 @@ #include "qml.h" #include "qmlparserstatus.h" +#include <private/qlistmodelinterface_p.h> #include <QtCore/qthread.h> #include <QtScript/qscriptvalue.h> #include <QtCore/qurl.h> +QT_BEGIN_NAMESPACE + class QmlWorkerScript; class QmlWorkerScriptEnginePrivate; class QmlWorkerScriptEngine : public QThread @@ -110,6 +113,48 @@ private: int m_scriptId; QUrl m_source; }; + +class QmlWorkerListModelAgent; +class QmlWorkerListModel : public QListModelInterface +{ + Q_OBJECT + Q_PROPERTY(int count READ count NOTIFY countChanged) + +public: + QmlWorkerListModel(QObject * = 0); + virtual ~QmlWorkerListModel(); + + Q_INVOKABLE void clear(); + Q_INVOKABLE void remove(int index); + Q_INVOKABLE void append(const QScriptValue &); + Q_INVOKABLE void insert(int index, const QScriptValue&); + Q_INVOKABLE QScriptValue get(int index) const; + Q_INVOKABLE void set(int index, const QScriptValue &); + + QmlWorkerListModelAgent *agent(); + + virtual QList<int> roles() const; + virtual QString toString(int role) const; + virtual int count() const; + virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const; + virtual QVariant data(int index, int role) const; + +Q_SIGNALS: + void countChanged(); + +private: + friend class QmlWorkerListModelAgent; + + QHash<int, QString> m_roles; + QHash<QString, int> m_strings; + QList<QHash<int, QVariant> > m_values; + + QmlWorkerListModelAgent *m_agent; +}; + +QT_END_NAMESPACE + QML_DECLARE_TYPE(QmlWorkerScript); +QML_DECLARE_TYPE(QmlWorkerListModel); #endif // QMLWORKERSCRIPT_P_H |