summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/api.pri3
-rw-r--r--src/script/api/qscriptable.cpp22
-rw-r--r--src/script/api/qscriptable.h22
-rw-r--r--src/script/api/qscriptable_p.h22
-rw-r--r--src/script/api/qscriptclass.cpp22
-rw-r--r--src/script/api/qscriptclass.h22
-rw-r--r--src/script/api/qscriptclasspropertyiterator.cpp22
-rw-r--r--src/script/api/qscriptclasspropertyiterator.h22
-rw-r--r--src/script/api/qscriptcontext.cpp22
-rw-r--r--src/script/api/qscriptcontext.h22
-rw-r--r--src/script/api/qscriptcontext_p.h22
-rw-r--r--src/script/api/qscriptcontextinfo.cpp22
-rw-r--r--src/script/api/qscriptcontextinfo.h22
-rw-r--r--src/script/api/qscriptengine.cpp329
-rw-r--r--src/script/api/qscriptengine.h25
-rw-r--r--src/script/api/qscriptengine_p.h127
-rw-r--r--src/script/api/qscriptengineagent.cpp24
-rw-r--r--src/script/api/qscriptengineagent.h22
-rw-r--r--src/script/api/qscriptengineagent_p.h22
-rw-r--r--src/script/api/qscriptextensioninterface.h22
-rw-r--r--src/script/api/qscriptextensionplugin.cpp22
-rw-r--r--src/script/api/qscriptextensionplugin.h22
-rw-r--r--src/script/api/qscriptprogram.cpp207
-rw-r--r--src/script/api/qscriptprogram.h68
-rw-r--r--src/script/api/qscriptprogram_p.h77
-rw-r--r--src/script/api/qscriptstring.cpp54
-rw-r--r--src/script/api/qscriptstring.h24
-rw-r--r--src/script/api/qscriptstring_p.h29
-rw-r--r--src/script/api/qscriptvalue.cpp138
-rw-r--r--src/script/api/qscriptvalue.h25
-rw-r--r--src/script/api/qscriptvalue_p.h43
-rw-r--r--src/script/api/qscriptvalueiterator.cpp22
-rw-r--r--src/script/api/qscriptvalueiterator.h22
-rw-r--r--src/script/bridge/bridge.pri8
-rw-r--r--src/script/bridge/qscriptactivationobject.cpp22
-rw-r--r--src/script/bridge/qscriptactivationobject_p.h22
-rw-r--r--src/script/bridge/qscriptclassobject.cpp33
-rw-r--r--src/script/bridge/qscriptclassobject_p.h37
-rw-r--r--src/script/bridge/qscriptdeclarativeclass.cpp339
-rw-r--r--src/script/bridge/qscriptdeclarativeclass_p.h111
-rw-r--r--src/script/bridge/qscriptdeclarativeobject.cpp174
-rw-r--r--src/script/bridge/qscriptdeclarativeobject_p.h107
-rw-r--r--src/script/bridge/qscriptfunction.cpp22
-rw-r--r--src/script/bridge/qscriptfunction_p.h22
-rw-r--r--src/script/bridge/qscriptglobalobject.cpp22
-rw-r--r--src/script/bridge/qscriptglobalobject_p.h22
-rw-r--r--src/script/bridge/qscriptobject.cpp52
-rw-r--r--src/script/bridge/qscriptobject_p.h63
-rw-r--r--src/script/bridge/qscriptqobject.cpp38
-rw-r--r--src/script/bridge/qscriptqobject_p.h22
-rw-r--r--src/script/bridge/qscriptvariant.cpp22
-rw-r--r--src/script/bridge/qscriptvariant_p.h22
-rwxr-xr-xsrc/script/parser/make-parser.sh53
-rw-r--r--src/script/parser/qscript.g84
-rw-r--r--src/script/parser/qscriptast.cpp22
-rw-r--r--src/script/parser/qscriptast_p.h22
-rw-r--r--src/script/parser/qscriptastfwd_p.h22
-rw-r--r--src/script/parser/qscriptastvisitor.cpp22
-rw-r--r--src/script/parser/qscriptastvisitor_p.h22
-rw-r--r--src/script/parser/qscriptgrammar.cpp38
-rw-r--r--src/script/parser/qscriptgrammar_p.h61
-rw-r--r--src/script/parser/qscriptlexer.cpp22
-rw-r--r--src/script/parser/qscriptlexer_p.h22
-rw-r--r--src/script/parser/qscriptparser.cpp33
-rw-r--r--src/script/parser/qscriptparser_p.h23
-rw-r--r--src/script/parser/qscriptsyntaxchecker.cpp22
-rw-r--r--src/script/parser/qscriptsyntaxchecker_p.h22
-rw-r--r--src/script/utils/qscriptdate.cpp22
-rw-r--r--src/script/utils/qscriptdate_p.h22
69 files changed, 1779 insertions, 1506 deletions
diff --git a/src/script/api/api.pri b/src/script/api/api.pri
index 17ec9b6e08..aebadd5b1c 100644
--- a/src/script/api/api.pri
+++ b/src/script/api/api.pri
@@ -6,6 +6,7 @@ SOURCES += \
$$PWD/qscriptengine.cpp \
$$PWD/qscriptengineagent.cpp \
$$PWD/qscriptextensionplugin.cpp \
+ $$PWD/qscriptprogram.cpp \
$$PWD/qscriptstring.cpp \
$$PWD/qscriptvalue.cpp \
$$PWD/qscriptvalueiterator.cpp \
@@ -23,6 +24,8 @@ HEADERS += \
$$PWD/qscriptengineagent_p.h \
$$PWD/qscriptextensioninterface.h \
$$PWD/qscriptextensionplugin.h \
+ $$PWD/qscriptprogram.h \
+ $$PWD/qscriptprogram_p.h \
$$PWD/qscriptstring.h \
$$PWD/qscriptstring_p.h \
$$PWD/qscriptvalue.h \
diff --git a/src/script/api/qscriptable.cpp b/src/script/api/qscriptable.cpp
index c83653c5bf..28e72c893f 100644
--- a/src/script/api/qscriptable.cpp
+++ b/src/script/api/qscriptable.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptable.h b/src/script/api/qscriptable.h
index 7b92f74144..697a271971 100644
--- a/src/script/api/qscriptable.h
+++ b/src/script/api/qscriptable.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptable_p.h b/src/script/api/qscriptable_p.h
index b4e84f0b0a..094950c364 100644
--- a/src/script/api/qscriptable_p.h
+++ b/src/script/api/qscriptable_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptclass.cpp b/src/script/api/qscriptclass.cpp
index ec71d85dd8..c982682f33 100644
--- a/src/script/api/qscriptclass.cpp
+++ b/src/script/api/qscriptclass.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptclass.h b/src/script/api/qscriptclass.h
index c416f37d6a..df3b1a9e02 100644
--- a/src/script/api/qscriptclass.h
+++ b/src/script/api/qscriptclass.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptclasspropertyiterator.cpp b/src/script/api/qscriptclasspropertyiterator.cpp
index 14077ce22e..b8f278ac83 100644
--- a/src/script/api/qscriptclasspropertyiterator.cpp
+++ b/src/script/api/qscriptclasspropertyiterator.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptclasspropertyiterator.h b/src/script/api/qscriptclasspropertyiterator.h
index f8ea065c15..affec81f42 100644
--- a/src/script/api/qscriptclasspropertyiterator.h
+++ b/src/script/api/qscriptclasspropertyiterator.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp
index caa4dc27c3..77bac9b256 100644
--- a/src/script/api/qscriptcontext.cpp
+++ b/src/script/api/qscriptcontext.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptcontext.h b/src/script/api/qscriptcontext.h
index 348ac9b12d..5284b13161 100644
--- a/src/script/api/qscriptcontext.h
+++ b/src/script/api/qscriptcontext.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptcontext_p.h b/src/script/api/qscriptcontext_p.h
index a451103778..e378b9221c 100644
--- a/src/script/api/qscriptcontext_p.h
+++ b/src/script/api/qscriptcontext_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp
index 6c34c5e434..d3a15ece5c 100644
--- a/src/script/api/qscriptcontextinfo.cpp
+++ b/src/script/api/qscriptcontextinfo.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptcontextinfo.h b/src/script/api/qscriptcontextinfo.h
index 778473c70b..dcc57ad5fc 100644
--- a/src/script/api/qscriptcontextinfo.h
+++ b/src/script/api/qscriptcontextinfo.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp
index b1f36be21b..d519102c02 100644
--- a/src/script/api/qscriptengine.cpp
+++ b/src/script/api/qscriptengine.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -51,6 +33,8 @@
#include "qscriptvalue_p.h"
#include "qscriptvalueiterator.h"
#include "qscriptclass.h"
+#include "qscriptprogram.h"
+#include "qscriptprogram_p.h"
#include "qdebug.h"
#include <QtCore/qstringlist.h>
@@ -343,15 +327,10 @@ public:
namespace QScript
{
-struct GlobalClientData : public JSC::JSGlobalData::ClientData
+void GlobalClientData::mark(JSC::MarkStack& markStack)
{
- GlobalClientData(QScriptEnginePrivate *e)
- : engine(e) {}
- virtual ~GlobalClientData() {}
- virtual void mark(JSC::MarkStack& markStack) { engine->mark(markStack); }
-
- QScriptEnginePrivate *engine;
-};
+ engine->mark(markStack);
+}
class TimeoutCheckerProxy : public JSC::TimeoutChecker
{
@@ -452,11 +431,6 @@ qsreal integerFromString(const QString &str, int radix)
return integerFromString(ba.constData(), ba.size(), radix);
}
-QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec)
-{
- return static_cast<GlobalClientData*>(exec->globalData().clientData)->engine;
-}
-
bool isFunction(JSC::JSValue value)
{
if (!value || !value.isObject())
@@ -797,6 +771,10 @@ QScriptEnginePrivate::QScriptEnginePrivate()
registeredScriptStrings(0), inEval(false)
{
qMetaTypeId<QScriptValue>();
+ qMetaTypeId<QList<int> >();
+#ifndef QT_NO_QOBJECT
+ qMetaTypeId<QObjectList>();
+#endif
JSC::initializeThreading(); // ### hmmm
@@ -991,26 +969,6 @@ void QScriptEnginePrivate::setDefaultPrototype(int metaTypeId, JSC::JSValue prot
info->prototype = prototype;
}
-QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame)
-{
- if (frame && frame->callerFrame()->hasHostCallFrameFlag() && !frame->callee()
- && frame->callerFrame()->removeHostCallFrameFlag() == QScript::scriptEngineFromExec(frame)->globalExec()) {
- //skip the "fake" context created in Interpreter::execute.
- frame = frame->callerFrame()->removeHostCallFrameFlag();
- }
- return reinterpret_cast<QScriptContext *>(frame);
-}
-
-JSC::ExecState *QScriptEnginePrivate::frameForContext(QScriptContext *context)
-{
- return reinterpret_cast<JSC::ExecState*>(context);
-}
-
-const JSC::ExecState *QScriptEnginePrivate::frameForContext(const QScriptContext *context)
-{
- return reinterpret_cast<const JSC::ExecState*>(context);
-}
-
JSC::JSGlobalObject *QScriptEnginePrivate::originalGlobalObject() const
{
return globalData->head;
@@ -1052,11 +1010,6 @@ void QScriptEnginePrivate::setGlobalObject(JSC::JSObject *object)
}
}
-JSC::ExecState *QScriptEnginePrivate::globalExec() const
-{
- return originalGlobalObject()->globalExec();
-}
-
/*!
\internal
@@ -1122,6 +1075,8 @@ void QScriptEnginePrivate::setContextFlags(JSC::ExecState *exec, uint flags)
void QScriptEnginePrivate::mark(JSC::MarkStack& markStack)
{
+ Q_Q(QScriptEngine);
+
markStack.append(originalGlobalObject());
markStack.append(globalObject());
if (originalGlobalObjectProxy)
@@ -1159,6 +1114,22 @@ void QScriptEnginePrivate::mark(JSC::MarkStack& markStack)
markStack.append((*it)->prototype);
}
}
+
+ {
+ QScriptContext *context = q->currentContext();
+
+ while (context) {
+ JSC::ScopeChainNode *node = frameForContext(context)->scopeChain();
+ JSC::ScopeChainIterator it(node);
+ for (it = node->begin(); it != node->end(); ++it) {
+ JSC::JSObject *object = *it;
+ if (object)
+ markStack.append(object);
+ }
+
+ context = context->parentContext();
+ }
+ }
}
bool QScriptEnginePrivate::isCollecting() const
@@ -1186,6 +1157,73 @@ void QScriptEnginePrivate::agentDeleted(QScriptEngineAgent *agent)
}
}
+JSC::JSValue QScriptEnginePrivate::evaluateHelper(JSC::ExecState *exec, intptr_t sourceId,
+ JSC::EvalExecutable *executable,
+ bool &compile)
+{
+ Q_Q(QScriptEngine);
+ JSC::JSLock lock(false); // ### hmmm
+ QBoolBlocker inEvalBlocker(inEval, true);
+ q->currentContext()->activationObject(); //force the creation of a context for native function;
+
+ JSC::Debugger* debugger = originalGlobalObject()->debugger();
+ if (debugger)
+ debugger->evaluateStart(sourceId);
+
+ q->clearExceptions();
+ JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject());
+
+ if (compile) {
+ JSC::JSObject* error = executable->compile(exec, exec->scopeChain());
+ if (error) {
+ compile = false;
+ exec->setException(error);
+
+ if (debugger) {
+ debugger->exceptionThrow(JSC::DebuggerCallFrame(exec, error), sourceId, false);
+ debugger->evaluateStop(error, sourceId);
+ }
+
+ return error;
+ }
+ }
+
+ JSC::JSValue thisValue = thisForContext(exec);
+ JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull())
+ ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
+ JSC::JSValue exceptionValue;
+ timeoutChecker()->setShouldAbort(false);
+ if (processEventsInterval > 0)
+ timeoutChecker()->reset();
+
+ JSC::JSValue result = exec->interpreter()->execute(executable, exec, thisObject, exec->scopeChain(), &exceptionValue);
+
+ if (timeoutChecker()->shouldAbort()) {
+ if (abortResult.isError())
+ exec->setException(scriptValueToJSCValue(abortResult));
+
+ if (debugger)
+ debugger->evaluateStop(scriptValueToJSCValue(abortResult), sourceId);
+
+ return scriptValueToJSCValue(abortResult);
+ }
+
+ if (exceptionValue) {
+ exec->setException(exceptionValue);
+
+ if (debugger)
+ debugger->evaluateStop(exceptionValue, sourceId);
+
+ return exceptionValue;
+ }
+
+ if (debugger)
+ debugger->evaluateStop(result, sourceId);
+
+ Q_ASSERT(!exec->hadException());
+ return result;
+}
+
#ifndef QT_NO_QOBJECT
JSC::JSValue QScriptEnginePrivate::newQObject(
@@ -2146,75 +2184,41 @@ QScriptSyntaxCheckResult QScriptEnginePrivate::checkSyntax(const QString &progra
QScriptValue QScriptEngine::evaluate(const QString &program, const QString &fileName, int lineNumber)
{
Q_D(QScriptEngine);
-
- JSC::JSLock lock(false); // ### hmmm
- QBoolBlocker inEval(d->inEval, true);
- currentContext()->activationObject(); //force the creation of a context for native function;
-
- JSC::Debugger* debugger = d->originalGlobalObject()->debugger();
-
- JSC::UString jscProgram = program;
- JSC::UString jscFileName = fileName;
- JSC::ExecState* exec = d->currentFrame;
WTF::PassRefPtr<QScript::UStringSourceProviderWithFeedback> provider
- = QScript::UStringSourceProviderWithFeedback::create(jscProgram, jscFileName, lineNumber, d);
+ = QScript::UStringSourceProviderWithFeedback::create(program, fileName, lineNumber, d);
intptr_t sourceId = provider->asID();
JSC::SourceCode source(provider, lineNumber); //after construction of SourceCode provider variable will be null.
- if (debugger)
- debugger->evaluateStart(sourceId);
-
- exec->clearException();
- JSC::DynamicGlobalObjectScope dynamicGlobalObjectScope(exec, exec->scopeChain()->globalObject());
-
+ JSC::ExecState* exec = d->currentFrame;
JSC::EvalExecutable executable(exec, source);
- JSC::JSObject* error = executable.compile(exec, exec->scopeChain());
- if (error) {
- exec->setException(error);
-
- if (debugger) {
- debugger->exceptionThrow(JSC::DebuggerCallFrame(exec, error), sourceId, false);
- debugger->evaluateStop(error, sourceId);
- }
-
- return d->scriptValueFromJSCValue(error);
- }
-
- JSC::JSValue thisValue = d->thisForContext(exec);
- JSC::JSObject* thisObject = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec);
- JSC::JSValue exceptionValue;
- d->timeoutChecker()->setShouldAbort(false);
- if (d->processEventsInterval > 0)
- d->timeoutChecker()->reset();
- JSC::JSValue result = exec->interpreter()->execute(&executable, exec, thisObject, exec->scopeChain(), &exceptionValue);
-
- if (d->timeoutChecker()->shouldAbort()) {
- if (d->abortResult.isError())
- exec->setException(d->scriptValueToJSCValue(d->abortResult));
-
- if (debugger)
- debugger->evaluateStop(d->scriptValueToJSCValue(d->abortResult), sourceId);
-
- return d->abortResult;
- }
-
- if (exceptionValue) {
- exec->setException(exceptionValue);
-
- if (debugger)
- debugger->evaluateStop(exceptionValue, sourceId);
+ bool compile = true;
+ return d->scriptValueFromJSCValue(d->evaluateHelper(exec, sourceId, &executable, compile));
+}
- return d->scriptValueFromJSCValue(exceptionValue);
- }
+/*!
+ \internal
+ \since 4.6
- if (debugger)
- debugger->evaluateStop(result, sourceId);
+ Evaluates the given \a program and returns the result of the
+ evaluation.
+*/
+QScriptValue QScriptEngine::evaluate(const QScriptProgram &program)
+{
+ Q_D(QScriptEngine);
+ QScriptProgramPrivate *program_d = QScriptProgramPrivate::get(program);
+ if (!program_d)
+ return QScriptValue();
- Q_ASSERT(!exec->hadException());
+ JSC::ExecState* exec = d->currentFrame;
+ JSC::EvalExecutable *executable = program_d->executable(exec, d);
+ bool compile = !program_d->isCompiled;
+ JSC::JSValue result = d->evaluateHelper(exec, program_d->sourceId,
+ executable, compile);
+ if (compile)
+ program_d->isCompiled = true;
return d->scriptValueFromJSCValue(result);
}
-
/*!
Returns the current context.
@@ -2277,7 +2281,8 @@ QScriptContext *QScriptEngine::pushContext()
return the new top frame. (might be the same as exec if a new stackframe was not needed) or 0 if stack overflow
*/
JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSValue _thisObject,
- const JSC::ArgList& args, JSC::JSObject *callee, bool calledAsConstructor)
+ const JSC::ArgList& args, JSC::JSObject *callee, bool calledAsConstructor,
+ bool clearScopeChain)
{
JSC::JSValue thisObject = _thisObject;
if (calledAsConstructor) {
@@ -2311,7 +2316,14 @@ JSC::CallFrame *QScriptEnginePrivate::pushContext(JSC::CallFrame *exec, JSC::JSV
for (it = args.begin(); it != args.end(); ++it)
newCallFrame[++dst] = *it;
newCallFrame += argc + JSC::RegisterFile::CallFrameHeaderSize;
- newCallFrame->init(0, /*vPC=*/0, exec->scopeChain(), exec, flags | ShouldRestoreCallFrame, argc, callee);
+
+ if (!clearScopeChain) {
+ newCallFrame->init(0, /*vPC=*/0, exec->scopeChain(), exec, flags | ShouldRestoreCallFrame, argc, callee);
+ } else {
+ JSC::JSObject *jscObject = originalGlobalObject();
+ JSC::ScopeChainNode *scn = new JSC::ScopeChainNode(0, jscObject, &exec->globalData(), jscObject);
+ newCallFrame->init(0, /*vPC=*/0, scn, exec, flags | ShouldRestoreCallFrame, argc, callee);
+ }
} else {
setContextFlags(newCallFrame, flags);
#if ENABLE(JIT)
@@ -2381,7 +2393,7 @@ bool QScriptEngine::hasUncaughtException() const
{
Q_D(const QScriptEngine);
JSC::ExecState* exec = d->globalExec();
- return exec->hadException();
+ return exec->hadException() || d->currentException().isValid();
}
/*!
@@ -2398,8 +2410,13 @@ bool QScriptEngine::hasUncaughtException() const
QScriptValue QScriptEngine::uncaughtException() const
{
Q_D(const QScriptEngine);
+ QScriptValue result;
JSC::ExecState* exec = d->globalExec();
- return const_cast<QScriptEnginePrivate*>(d)->scriptValueFromJSCValue(exec->exception());
+ if (exec->hadException())
+ result = const_cast<QScriptEnginePrivate*>(d)->scriptValueFromJSCValue(exec->exception());
+ else
+ result = d->currentException();
+ return result;
}
/*!
@@ -2452,6 +2469,7 @@ void QScriptEngine::clearExceptions()
Q_D(QScriptEngine);
JSC::ExecState* exec = d->currentFrame;
exec->clearException();
+ d->clearCurrentException();
}
/*!
@@ -2533,63 +2551,50 @@ QScriptValue QScriptEngine::create(int type, const void *ptr)
QScriptValue QScriptEnginePrivate::create(int type, const void *ptr)
{
+ Q_Q(QScriptEngine);
Q_ASSERT(ptr != 0);
QScriptValue result;
QScriptTypeInfo *info = m_typeInfos.value(type);
if (info && info->marshal) {
- result = info->marshal(q_func(), ptr);
+ result = info->marshal(q, ptr);
} else {
// check if it's one of the types we know
switch (QMetaType::Type(type)) {
case QMetaType::Void:
- result = QScriptValue(QScriptValue::UndefinedValue);
- break;
+ return QScriptValue(q, QScriptValue::UndefinedValue);
case QMetaType::Bool:
- result = QScriptValue(*reinterpret_cast<const bool*>(ptr));
- break;
+ return QScriptValue(q, *reinterpret_cast<const bool*>(ptr));
case QMetaType::Int:
- result = QScriptValue(*reinterpret_cast<const int*>(ptr));
- break;
+ return QScriptValue(q, *reinterpret_cast<const int*>(ptr));
case QMetaType::UInt:
- result = QScriptValue(*reinterpret_cast<const uint*>(ptr));
- break;
+ return QScriptValue(q, *reinterpret_cast<const uint*>(ptr));
case QMetaType::LongLong:
- result = QScriptValue(qsreal(*reinterpret_cast<const qlonglong*>(ptr)));
- break;
+ return QScriptValue(q, qsreal(*reinterpret_cast<const qlonglong*>(ptr)));
case QMetaType::ULongLong:
#if defined(Q_OS_WIN) && defined(_MSC_FULL_VER) && _MSC_FULL_VER <= 12008804
#pragma message("** NOTE: You need the Visual Studio Processor Pack to compile support for 64bit unsigned integers.")
- result = QScriptValue(qsreal((qlonglong)*reinterpret_cast<const qulonglong*>(ptr)));
+ return QScriptValue(q, qsreal((qlonglong)*reinterpret_cast<const qulonglong*>(ptr)));
#elif defined(Q_CC_MSVC) && !defined(Q_CC_MSVC_NET)
- result = QScriptValue(qsreal((qlonglong)*reinterpret_cast<const qulonglong*>(ptr)));
+ return QScriptValue(q, qsreal((qlonglong)*reinterpret_cast<const qulonglong*>(ptr)));
#else
- result = QScriptValue(qsreal(*reinterpret_cast<const qulonglong*>(ptr)));
+ return QScriptValue(q, qsreal(*reinterpret_cast<const qulonglong*>(ptr)));
#endif
- break;
case QMetaType::Double:
- result = QScriptValue(*reinterpret_cast<const double*>(ptr));
- break;
+ return QScriptValue(q, qsreal(*reinterpret_cast<const double*>(ptr)));
case QMetaType::QString:
- result = QScriptValue(q_func(), *reinterpret_cast<const QString*>(ptr));
- break;
+ return QScriptValue(q, *reinterpret_cast<const QString*>(ptr));
case QMetaType::Float:
- result = QScriptValue(*reinterpret_cast<const float*>(ptr));
- break;
+ return QScriptValue(q, *reinterpret_cast<const float*>(ptr));
case QMetaType::Short:
- result = QScriptValue(*reinterpret_cast<const short*>(ptr));
- break;
+ return QScriptValue(q, *reinterpret_cast<const short*>(ptr));
case QMetaType::UShort:
- result = QScriptValue(*reinterpret_cast<const unsigned short*>(ptr));
- break;
+ return QScriptValue(q, *reinterpret_cast<const unsigned short*>(ptr));
case QMetaType::Char:
- result = QScriptValue(*reinterpret_cast<const char*>(ptr));
- break;
+ return QScriptValue(q, *reinterpret_cast<const char*>(ptr));
case QMetaType::UChar:
- result = QScriptValue(*reinterpret_cast<const unsigned char*>(ptr));
- break;
+ return QScriptValue(q, *reinterpret_cast<const unsigned char*>(ptr));
case QMetaType::QChar:
- result = QScriptValue((*reinterpret_cast<const QChar*>(ptr)).unicode());
- break;
+ return QScriptValue(q, (*reinterpret_cast<const QChar*>(ptr)).unicode());
case QMetaType::QStringList:
result = arrayFromStringList(*reinterpret_cast<const QStringList *>(ptr));
break;
@@ -2600,38 +2605,38 @@ QScriptValue QScriptEnginePrivate::create(int type, const void *ptr)
result = objectFromVariantMap(*reinterpret_cast<const QVariantMap *>(ptr));
break;
case QMetaType::QDateTime:
- result = q_func()->newDate(*reinterpret_cast<const QDateTime *>(ptr));
+ result = q->newDate(*reinterpret_cast<const QDateTime *>(ptr));
break;
case QMetaType::QDate:
- result = q_func()->newDate(QDateTime(*reinterpret_cast<const QDate *>(ptr)));
+ result = q->newDate(QDateTime(*reinterpret_cast<const QDate *>(ptr)));
break;
#ifndef QT_NO_REGEXP
case QMetaType::QRegExp:
- result = q_func()->newRegExp(*reinterpret_cast<const QRegExp *>(ptr));
+ result = q->newRegExp(*reinterpret_cast<const QRegExp *>(ptr));
break;
#endif
#ifndef QT_NO_QOBJECT
case QMetaType::QObjectStar:
case QMetaType::QWidgetStar:
- result = q_func()->newQObject(*reinterpret_cast<QObject* const *>(ptr));
+ result = q->newQObject(*reinterpret_cast<QObject* const *>(ptr));
break;
#endif
default:
if (type == qMetaTypeId<QScriptValue>()) {
result = *reinterpret_cast<const QScriptValue*>(ptr);
if (!result.isValid())
- result = QScriptValue(QScriptValue::UndefinedValue);
+ return QScriptValue(q, QScriptValue::UndefinedValue);
}
#ifndef QT_NO_QOBJECT
// lazy registration of some common list types
else if (type == qMetaTypeId<QObjectList>()) {
- qScriptRegisterSequenceMetaType<QObjectList>(q_func());
+ qScriptRegisterSequenceMetaType<QObjectList>(q);
return create(type, ptr);
}
#endif
else if (type == qMetaTypeId<QList<int> >()) {
- qScriptRegisterSequenceMetaType<QList<int> >(q_func());
+ qScriptRegisterSequenceMetaType<QList<int> >(q);
return create(type, ptr);
}
@@ -2640,9 +2645,9 @@ QScriptValue QScriptEnginePrivate::create(int type, const void *ptr)
if (typeName == "QVariant")
result = scriptValueFromVariant(*reinterpret_cast<const QVariant*>(ptr));
if (typeName.endsWith('*') && !*reinterpret_cast<void* const *>(ptr))
- result = QScriptValue(QScriptValue::NullValue);
+ return QScriptValue(q, QScriptValue::NullValue);
else
- result = q_func()->newVariant(QVariant(type, ptr));
+ result = q->newVariant(QVariant(type, ptr));
}
}
}
@@ -2657,8 +2662,8 @@ bool QScriptEnginePrivate::convert(const QScriptValue &value,
int type, void *ptr,
QScriptEnginePrivate *eng)
{
- if (!eng && value.engine())
- eng = QScriptEnginePrivate::get(value.engine());
+ if (!eng)
+ eng = QScriptValuePrivate::getEngine(value);
if (eng) {
QScriptTypeInfo *info = eng->m_typeInfos.value(type);
if (info && info->demarshal) {
diff --git a/src/script/api/qscriptengine.h b/src/script/api/qscriptengine.h
index 701f9c69f3..8cacc52b6e 100644
--- a/src/script/api/qscriptengine.h
+++ b/src/script/api/qscriptengine.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -56,6 +38,7 @@
#include <QtScript/qscriptvalue.h>
#include <QtScript/qscriptcontext.h>
#include <QtScript/qscriptstring.h>
+#include <QtScript/qscriptprogram.h>
QT_BEGIN_HEADER
@@ -166,6 +149,8 @@ public:
QScriptValue evaluate(const QString &program, const QString &fileName = QString(), int lineNumber = 1);
+ QScriptValue evaluate(const QScriptProgram &program);
+
bool isEvaluating() const;
void abortEvaluation(const QScriptValue &result = QScriptValue());
diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h
index f1fc13542f..68bf8e09ef 100644
--- a/src/script/api/qscriptengine_p.h
+++ b/src/script/api/qscriptengine_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -70,6 +52,7 @@
namespace JSC
{
+ class EvalExecutable;
class ExecState;
typedef ExecState CallFrame;
class JSCell;
@@ -101,11 +84,22 @@ namespace QScript
class TimeoutCheckerProxy;
//some conversion helper functions
- QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec);
+ inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec);
bool isFunction(JSC::JSValue value);
class UStringSourceProviderWithFeedback;
-}
+
+struct GlobalClientData : public JSC::JSGlobalData::ClientData
+{
+ GlobalClientData(QScriptEnginePrivate *e)
+ : engine(e) {}
+ virtual ~GlobalClientData() {}
+ virtual void mark(JSC::MarkStack& markStack);
+
+ QScriptEnginePrivate *engine;
+};
+
+} // namespace QScript
class QScriptEnginePrivate
#ifndef QT_NO_QOBJECT
@@ -147,22 +141,22 @@ public:
JSC::JSValue defaultPrototype(int metaTypeId) const;
void setDefaultPrototype(int metaTypeId, JSC::JSValue prototype);
- static QScriptContext *contextForFrame(JSC::ExecState *frame);
- static JSC::ExecState *frameForContext(QScriptContext *context);
- static const JSC::ExecState *frameForContext(const QScriptContext *context);
+ static inline QScriptContext *contextForFrame(JSC::ExecState *frame);
+ static inline JSC::ExecState *frameForContext(QScriptContext *context);
+ static inline const JSC::ExecState *frameForContext(const QScriptContext *context);
JSC::JSGlobalObject *originalGlobalObject() const;
JSC::JSObject *getOriginalGlobalObjectProxy();
JSC::JSObject *customGlobalObject() const;
JSC::JSObject *globalObject() const;
void setGlobalObject(JSC::JSObject *object);
- JSC::ExecState *globalExec() const;
+ inline JSC::ExecState *globalExec() const;
JSC::JSValue toUsableValue(JSC::JSValue value);
static JSC::JSValue thisForContext(JSC::ExecState *frame);
static JSC::Register *thisRegisterForFrame(JSC::ExecState *frame);
JSC::CallFrame *pushContext(JSC::CallFrame *exec, JSC::JSValue thisObject, const JSC::ArgList& args,
- JSC::JSObject *callee, bool calledAsConstructor = false);
+ JSC::JSObject *callee, bool calledAsConstructor = false, bool clearScopeChain = false);
void popContext();
void mark(JSC::MarkStack& markStack);
@@ -183,6 +177,10 @@ public:
void agentDeleted(QScriptEngineAgent *agent);
+ void setCurrentException(QScriptValue exception) { m_currentException = exception; }
+ QScriptValue currentException() const { return m_currentException; }
+ void clearCurrentException() { m_currentException.d_ptr.reset(); }
+
#ifndef QT_NO_QOBJECT
JSC::JSValue newQObject(QObject *object,
QScriptEngine::ValueOwnership ownership = QScriptEngine::QtOwnership,
@@ -196,6 +194,10 @@ public:
const QByteArray &targetType,
void **result);
+ JSC::JSValue evaluateHelper(JSC::ExecState *exec, intptr_t sourceId,
+ JSC::EvalExecutable *executable,
+ bool &compile);
+
QScript::QObjectData *qobjectData(QObject *object);
void disposeQObject(QObject *object);
void emitSignalHandlerException();
@@ -263,6 +265,7 @@ public:
QSet<QString> extensionsBeingImported;
QHash<intptr_t, QScript::UStringSourceProviderWithFeedback*> loadedScripts;
+ QScriptValue m_currentException;
#ifndef QT_NO_QOBJECT
QHash<QObject*, QScript::QObjectData*> m_qobjectData;
@@ -362,6 +365,11 @@ private:
JSC::ExecState *oldFrame;
};
+inline QScriptEnginePrivate *scriptEngineFromExec(const JSC::ExecState *exec)
+{
+ return static_cast<GlobalClientData*>(exec->globalData().clientData)->engine;
+}
+
} // namespace QScript
inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(size_t size)
@@ -446,7 +454,7 @@ inline void QScriptValuePrivate::initFrom(JSC::JSValue value)
engine->registerScriptValue(this);
}
-inline void QScriptValuePrivate::initFrom(double value)
+inline void QScriptValuePrivate::initFrom(qsreal value)
{
type = Number;
numberValue = value;
@@ -468,6 +476,28 @@ inline QScriptValue QScriptValuePrivate::property(const QString &name, int resol
return property(JSC::Identifier(exec, name), resolveMode);
}
+inline QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolveMode) const
+{
+ Q_ASSERT(isObject());
+ JSC::ExecState *exec = engine->currentFrame;
+ JSC::JSObject *object = JSC::asObject(jscValue);
+ JSC::PropertySlot slot(object);
+ if ((resolveMode & QScriptValue::ResolvePrototype) && object->getPropertySlot(exec, id, slot))
+ return engine->scriptValueFromJSCValue(slot.getValue(exec, id));
+ return propertyHelper(id, resolveMode);
+}
+
+inline QScriptValue QScriptValuePrivate::property(quint32 index, int resolveMode) const
+{
+ Q_ASSERT(isObject());
+ JSC::ExecState *exec = engine->currentFrame;
+ JSC::JSObject *object = JSC::asObject(jscValue);
+ JSC::PropertySlot slot(object);
+ if ((resolveMode & QScriptValue::ResolvePrototype) && object->getPropertySlot(exec, index, slot))
+ return engine->scriptValueFromJSCValue(slot.getValue(exec, index));
+ return propertyHelper(index, resolveMode);
+}
+
inline void* QScriptValuePrivate::operator new(size_t size, QScriptEnginePrivate *engine)
{
if (engine)
@@ -484,6 +514,22 @@ inline void QScriptValuePrivate::operator delete(void *ptr)
qFree(d);
}
+inline void QScriptValuePrivate::saveException(JSC::ExecState *exec, JSC::JSValue *val)
+{
+ if (exec) {
+ *val = exec->exception();
+ exec->clearException();
+ } else {
+ *val = JSC::JSValue();
+ }
+}
+
+inline void QScriptValuePrivate::restoreException(JSC::ExecState *exec, JSC::JSValue val)
+{
+ if (exec && val)
+ exec->setException(val);
+}
+
inline void QScriptEnginePrivate::registerScriptString(QScriptStringPrivate *value)
{
Q_ASSERT(value->type == QScriptStringPrivate::HeapAllocated);
@@ -507,6 +553,31 @@ inline void QScriptEnginePrivate::unregisterScriptString(QScriptStringPrivate *v
value->next = 0;
}
+inline QScriptContext *QScriptEnginePrivate::contextForFrame(JSC::ExecState *frame)
+{
+ if (frame && frame->callerFrame()->hasHostCallFrameFlag() && !frame->callee()
+ && frame->callerFrame()->removeHostCallFrameFlag() == QScript::scriptEngineFromExec(frame)->globalExec()) {
+ //skip the "fake" context created in Interpreter::execute.
+ frame = frame->callerFrame()->removeHostCallFrameFlag();
+ }
+ return reinterpret_cast<QScriptContext *>(frame);
+}
+
+inline JSC::ExecState *QScriptEnginePrivate::frameForContext(QScriptContext *context)
+{
+ return reinterpret_cast<JSC::ExecState*>(context);
+}
+
+inline const JSC::ExecState *QScriptEnginePrivate::frameForContext(const QScriptContext *context)
+{
+ return reinterpret_cast<const JSC::ExecState*>(context);
+}
+
+inline JSC::ExecState *QScriptEnginePrivate::globalExec() const
+{
+ return originalGlobalObject()->globalExec();
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/script/api/qscriptengineagent.cpp b/src/script/api/qscriptengineagent.cpp
index bc2eea2b0e..e7998b7d88 100644
--- a/src/script/api/qscriptengineagent.cpp
+++ b/src/script/api/qscriptengineagent.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -156,6 +138,7 @@ void QScriptEngineAgentPrivate::exceptionThrow(const JSC::DebuggerCallFrame& fra
QScriptValue value(engine->scriptValueFromJSCValue(frame.exception()));
q_ptr->exceptionThrow(sourceID, value, hasHandler);
engine->currentFrame = oldFrame;
+ engine->setCurrentException(value);
};
void QScriptEngineAgentPrivate::exceptionCatch(const JSC::DebuggerCallFrame& frame, intptr_t sourceID)
@@ -165,6 +148,7 @@ void QScriptEngineAgentPrivate::exceptionCatch(const JSC::DebuggerCallFrame& fra
QScriptValue value(engine->scriptValueFromJSCValue(frame.exception()));
q_ptr->exceptionCatch(sourceID, value);
engine->currentFrame = oldFrame;
+ engine->clearCurrentException();
}
void QScriptEngineAgentPrivate::atStatement(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, int column)
diff --git a/src/script/api/qscriptengineagent.h b/src/script/api/qscriptengineagent.h
index e260f4479b..37c25342a8 100644
--- a/src/script/api/qscriptengineagent.h
+++ b/src/script/api/qscriptengineagent.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptengineagent_p.h b/src/script/api/qscriptengineagent_p.h
index 86e437819b..efbcb4dcb8 100644
--- a/src/script/api/qscriptengineagent_p.h
+++ b/src/script/api/qscriptengineagent_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptextensioninterface.h b/src/script/api/qscriptextensioninterface.h
index 00841215d9..9923f4ac01 100644
--- a/src/script/api/qscriptextensioninterface.h
+++ b/src/script/api/qscriptextensioninterface.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptextensionplugin.cpp b/src/script/api/qscriptextensionplugin.cpp
index 782df58b74..d0c770b226 100644
--- a/src/script/api/qscriptextensionplugin.cpp
+++ b/src/script/api/qscriptextensionplugin.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptextensionplugin.h b/src/script/api/qscriptextensionplugin.h
index 6cc1efb0dc..e4d1da639a 100644
--- a/src/script/api/qscriptextensionplugin.h
+++ b/src/script/api/qscriptextensionplugin.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp
new file mode 100644
index 0000000000..deea582d54
--- /dev/null
+++ b/src/script/api/qscriptprogram.cpp
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** 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 QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-ONLY$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "config.h"
+#include "qscriptprogram.h"
+#include "qscriptprogram_p.h"
+#include "qscriptengine.h"
+#include "qscriptengine_p.h"
+
+#include "Executable.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \internal
+
+ \since 4.6
+ \class QScriptProgram
+
+ \brief The QScriptProgram class encapsulates a Qt Script program.
+
+ \ingroup script
+
+ QScriptProgram retains the compiled representation of the script if
+ possible. Thus, QScriptProgram can be used to evaluate the same
+ script multiple times more efficiently.
+
+ \code
+ QScriptEngine engine;
+ QScriptProgram program("1 + 2");
+ QScriptValue result = engine.evaluate(program);
+ \endcode
+*/
+
+QScriptProgramPrivate::QScriptProgramPrivate(const QString &src,
+ const QString &fn,
+ int ln)
+ : sourceCode(src), fileName(fn), firstLineNumber(ln),
+ engine(0), _executable(0), sourceId(-1), isCompiled(false)
+{
+ ref = 0;
+}
+
+QScriptProgramPrivate::~QScriptProgramPrivate()
+{
+ delete _executable;
+}
+
+QScriptProgramPrivate *QScriptProgramPrivate::get(const QScriptProgram &q)
+{
+ return const_cast<QScriptProgramPrivate*>(q.d_func());
+}
+
+JSC::EvalExecutable *QScriptProgramPrivate::executable(JSC::ExecState *exec,
+ QScriptEnginePrivate *eng)
+{
+ if (_executable) {
+ if (eng == engine)
+ return _executable;
+ delete _executable;
+ }
+ WTF::PassRefPtr<QScript::UStringSourceProviderWithFeedback> provider
+ = QScript::UStringSourceProviderWithFeedback::create(sourceCode, fileName, firstLineNumber, eng);
+ sourceId = provider->asID();
+ JSC::SourceCode source(provider, firstLineNumber); //after construction of SourceCode provider variable will be null.
+ _executable = new JSC::EvalExecutable(exec, source);
+ engine = eng;
+ isCompiled = false;
+ return _executable;
+}
+
+/*!
+ Constructs a null QScriptProgram.
+*/
+QScriptProgram::QScriptProgram()
+ : d_ptr(0)
+{
+}
+
+/*!
+ Constructs a new QScriptProgram with the given \a sourceCode, \a
+ fileName and \a firstLineNumber.
+*/
+QScriptProgram::QScriptProgram(const QString &sourceCode,
+ const QString fileName,
+ int firstLineNumber)
+ : d_ptr(new QScriptProgramPrivate(sourceCode, fileName, firstLineNumber))
+{
+}
+
+/*!
+ Constructs a new QScriptProgram that is a copy of \a other.
+*/
+QScriptProgram::QScriptProgram(const QScriptProgram &other)
+ : d_ptr(other.d_ptr)
+{
+}
+
+/*!
+ Destroys this QScriptProgram.
+*/
+QScriptProgram::~QScriptProgram()
+{
+ Q_D(QScriptProgram);
+ // if (d->engine && (d->ref == 1))
+ // d->engine->unregisterScriptProgram(d);
+}
+
+/*!
+ Assigns the \a other value to this QScriptProgram.
+*/
+QScriptProgram &QScriptProgram::operator=(const QScriptProgram &other)
+{
+ // if (d_func() && d_func()->engine && (d_func()->ref == 1))
+ // d_func()->engine->unregisterScriptProgram(d_func());
+ // }
+ d_ptr = other.d_ptr;
+ return *this;
+}
+
+/*!
+ Returns true if this QScriptProgram is null; otherwise
+ returns false.
+*/
+bool QScriptProgram::isNull() const
+{
+ Q_D(const QScriptProgram);
+ return (d == 0);
+}
+
+/*!
+ Returns the source code of this program.
+*/
+QString QScriptProgram::sourceCode() const
+{
+ Q_D(const QScriptProgram);
+ if (!d)
+ return QString();
+ return d->sourceCode;
+}
+
+/*!
+ Returns the filename associated with this program.
+*/
+QString QScriptProgram::fileName() const
+{
+ Q_D(const QScriptProgram);
+ if (!d)
+ return QString();
+ return d->fileName;
+}
+
+/*!
+ Returns the line number associated with this program.
+*/
+int QScriptProgram::firstLineNumber() const
+{
+ Q_D(const QScriptProgram);
+ if (!d)
+ return -1;
+ return d->firstLineNumber;
+}
+
+/*!
+ Returns true if this QScriptProgram is equal to \a other;
+ otherwise returns false.
+*/
+bool QScriptProgram::operator==(const QScriptProgram &other) const
+{
+ Q_D(const QScriptProgram);
+ if (d == other.d_func())
+ return true;
+ return (sourceCode() == other.sourceCode())
+ && (fileName() == other.fileName())
+ && (firstLineNumber() == other.firstLineNumber());
+}
+
+/*!
+ Returns true if this QScriptProgram is not equal to \a other;
+ otherwise returns false.
+*/
+bool QScriptProgram::operator!=(const QScriptProgram &other) const
+{
+ return !operator==(other);
+}
+
+QT_END_NAMESPACE
diff --git a/src/script/api/qscriptprogram.h b/src/script/api/qscriptprogram.h
new file mode 100644
index 0000000000..54e9f0122a
--- /dev/null
+++ b/src/script/api/qscriptprogram.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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 QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-ONLY$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCRIPTPROGRAM_H
+#define QSCRIPTPROGRAM_H
+
+#include <QtCore/qsharedpointer.h>
+
+#include <QtCore/qstring.h>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Script)
+
+class QScriptProgramPrivate;
+class Q_SCRIPT_EXPORT QScriptProgram
+{
+public:
+ QScriptProgram();
+ QScriptProgram(const QString &sourceCode,
+ const QString fileName = QString(),
+ int firstLineNumber = 1);
+ QScriptProgram(const QScriptProgram &other);
+ ~QScriptProgram();
+
+ QScriptProgram &operator=(const QScriptProgram &other);
+
+ bool isNull() const;
+
+ QString sourceCode() const;
+ QString fileName() const;
+ int firstLineNumber() const;
+
+ bool operator==(const QScriptProgram &other) const;
+ bool operator!=(const QScriptProgram &other) const;
+
+private:
+ QExplicitlySharedDataPointer<QScriptProgramPrivate> d_ptr;
+ Q_DECLARE_PRIVATE(QScriptProgram)
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QSCRIPTPROGRAM_H
diff --git a/src/script/api/qscriptprogram_p.h b/src/script/api/qscriptprogram_p.h
new file mode 100644
index 0000000000..61a5b0167b
--- /dev/null
+++ b/src/script/api/qscriptprogram_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** 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 QtScript module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-ONLY$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCRIPTPROGRAM_P_H
+#define QSCRIPTPROGRAM_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 <QtCore/qobjectdefs.h>
+
+namespace JSC
+{
+ class EvalExecutable;
+ class ExecState;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QScriptEnginePrivate;
+
+class QScriptProgramPrivate
+{
+public:
+ QScriptProgramPrivate(const QString &sourceCode,
+ const QString &fileName,
+ int firstLineNumber);
+ ~QScriptProgramPrivate();
+
+ static QScriptProgramPrivate *get(const QScriptProgram &q);
+
+ JSC::EvalExecutable *executable(JSC::ExecState *exec,
+ QScriptEnginePrivate *engine);
+
+ QBasicAtomicInt ref;
+
+ QString sourceCode;
+ QString fileName;
+ int firstLineNumber;
+
+ QScriptEnginePrivate *engine;
+ JSC::EvalExecutable *_executable;
+ intptr_t sourceId;
+ bool isCompiled;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp
index 2fb157f705..65f797db06 100644
--- a/src/script/api/qscriptstring.cpp
+++ b/src/script/api/qscriptstring.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -68,6 +50,10 @@ QT_BEGIN_NAMESPACE
Call the toString() function to obtain the string that a
QScriptString represents.
+
+ Call the toArrayIndex() function to convert a QScriptString to an
+ array index. This is useful when using QScriptClass to implement
+ array-like objects.
*/
/*!
@@ -139,8 +125,7 @@ QScriptString &QScriptString::operator=(const QScriptString &other)
*/
bool QScriptString::isValid() const
{
- Q_D(const QScriptString);
- return (d && d->engine);
+ return QScriptStringPrivate::isValid(*this);
}
/*!
@@ -165,6 +150,31 @@ bool QScriptString::operator!=(const QScriptString &other) const
}
/*!
+ \since 4.6
+
+ Attempts to convert this QScriptString to a QtScript array index,
+ and returns the result.
+
+ If a conversion error occurs, *\a{ok} is set to false; otherwise
+ *\a{ok} is set to true.
+*/
+quint32 QScriptString::toArrayIndex(bool *ok) const
+{
+ Q_D(const QScriptString);
+ if (!d) {
+ if (ok)
+ *ok = false;
+ return -1;
+ }
+ bool tmp;
+ bool *okok = ok ? ok : &tmp;
+ quint32 result = d->identifier.toArrayIndex(okok);
+ if (!*okok)
+ result = -1;
+ return result;
+}
+
+/*!
Returns the string that this QScriptString represents, or a
null string if this QScriptString is not valid.
diff --git a/src/script/api/qscriptstring.h b/src/script/api/qscriptstring.h
index 40d156c0b6..be99f533f9 100644
--- a/src/script/api/qscriptstring.h
+++ b/src/script/api/qscriptstring.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -67,6 +49,8 @@ public:
bool operator==(const QScriptString &other) const;
bool operator!=(const QScriptString &other) const;
+ quint32 toArrayIndex(bool *ok = 0) const;
+
QString toString() const;
operator QString() const;
diff --git a/src/script/api/qscriptstring_p.h b/src/script/api/qscriptstring_p.h
index d3bb47d82b..cb418ad27a 100644
--- a/src/script/api/qscriptstring_p.h
+++ b/src/script/api/qscriptstring_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -77,6 +59,8 @@ public:
inline void detachFromEngine();
+ static inline bool isValid(const QScriptString &q);
+
QBasicAtomicInt ref;
QScriptEnginePrivate *engine;
JSC::Identifier identifier;
@@ -114,6 +98,11 @@ inline void QScriptStringPrivate::detachFromEngine()
identifier = JSC::Identifier();
}
+inline bool QScriptStringPrivate::isValid(const QScriptString &q)
+{
+ return (q.d_ptr && q.d_ptr->engine);
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp
index b8340a7e51..286230fc25 100644
--- a/src/script/api/qscriptvalue.cpp
+++ b/src/script/api/qscriptvalue.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -71,6 +53,7 @@
#include "bridge/qscriptclassobject_p.h"
#include "bridge/qscriptvariant_p.h"
#include "bridge/qscriptqobject_p.h"
+#include "bridge/qscriptdeclarativeclass_p.h"
/*!
\since 4.3
@@ -213,7 +196,7 @@ qint32 ToInt32(qsreal n)
if (qIsNaN(n) || qIsInf(n) || (n == 0))
return 0;
- double sign = (n < 0) ? -1.0 : 1.0;
+ qsreal sign = (n < 0) ? -1.0 : 1.0;
qsreal abs_n = fabs(n);
n = ::fmod(sign * ::floor(abs_n), D32);
@@ -233,7 +216,7 @@ quint32 ToUint32(qsreal n)
if (qIsNaN(n) || qIsInf(n) || (n == 0))
return 0;
- double sign = (n < 0) ? -1.0 : 1.0;
+ qsreal sign = (n < 0) ? -1.0 : 1.0;
qsreal abs_n = fabs(n);
n = ::fmod(sign * ::floor(abs_n), D32);
@@ -251,7 +234,7 @@ quint16 ToUint16(qsreal n)
if (qIsNaN(n) || qIsInf(n) || (n == 0))
return 0;
- double sign = (n < 0) ? -1.0 : 1.0;
+ qsreal sign = (n < 0) ? -1.0 : 1.0;
qsreal abs_n = fabs(n);
n = ::fmod(sign * ::floor(abs_n), D16);
@@ -276,41 +259,36 @@ qsreal ToInteger(qsreal n)
} // namespace QScript
-QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolveMode) const
+QScriptValue QScriptValuePrivate::propertyHelper(const JSC::Identifier &id, int resolveMode) const
{
- Q_ASSERT(isObject());
- JSC::ExecState *exec = engine->currentFrame;
- JSC::JSObject *object = JSC::asObject(jscValue);
- JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object));
JSC::JSValue result;
- if (const_cast<JSC::JSObject*>(object)->getOwnPropertySlot(exec, id, slot)) {
- result = slot.getValue(exec, id);
- } else {
- if ((resolveMode & QScriptValue::ResolvePrototype)
- && const_cast<JSC::JSObject*>(object)->getPropertySlot(exec, id, slot)) {
+ if (!(resolveMode & QScriptValue::ResolvePrototype)) {
+ // Look in the object's own properties
+ JSC::ExecState *exec = engine->currentFrame;
+ JSC::JSObject *object = JSC::asObject(jscValue);
+ JSC::PropertySlot slot(object);
+ if (object->getOwnPropertySlot(exec, id, slot))
result = slot.getValue(exec, id);
- } else if (resolveMode & QScriptValue::ResolveScope) {
- // ### check if it's a function object and look in the scope chain
- QScriptValue scope = property(QString::fromLatin1("__qt_scope__"), QScriptValue::ResolveLocal);
- if (scope.isObject())
- result = engine->scriptValueToJSCValue(QScriptValuePrivate::get(scope)->property(id, resolveMode));
- }
+ }
+ if (!result && (resolveMode & QScriptValue::ResolveScope)) {
+ // ### check if it's a function object and look in the scope chain
+ QScriptValue scope = property(QString::fromLatin1("__qt_scope__"), QScriptValue::ResolveLocal);
+ if (scope.isObject())
+ result = engine->scriptValueToJSCValue(QScriptValuePrivate::get(scope)->property(id, resolveMode));
}
return engine->scriptValueFromJSCValue(result);
}
-QScriptValue QScriptValuePrivate::property(quint32 index, int resolveMode) const
+QScriptValue QScriptValuePrivate::propertyHelper(quint32 index, int resolveMode) const
{
- Q_ASSERT(isObject());
- JSC::ExecState *exec = engine->currentFrame;
- JSC::JSObject *object = JSC::asObject(jscValue);
- JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object));
JSC::JSValue result;
- if (const_cast<JSC::JSObject*>(object)->getOwnPropertySlot(exec, index, slot)) {
- result = slot.getValue(exec, index);
- } else if ((resolveMode & QScriptValue::ResolvePrototype)
- && const_cast<JSC::JSObject*>(object)->getPropertySlot(exec, index, slot)) {
- result = slot.getValue(exec, index);
+ if (!(resolveMode & QScriptValue::ResolvePrototype)) {
+ // Look in the object's own properties
+ JSC::ExecState *exec = engine->currentFrame;
+ JSC::JSObject *object = JSC::asObject(jscValue);
+ JSC::PropertySlot slot(object);
+ if (object->getOwnPropertySlot(exec, index, slot))
+ result = slot.getValue(exec, index);
}
return engine->scriptValueFromJSCValue(result);
}
@@ -318,8 +296,8 @@ QScriptValue QScriptValuePrivate::property(quint32 index, int resolveMode) const
void QScriptValuePrivate::setProperty(const JSC::Identifier &id, const QScriptValue &value,
const QScriptValue::PropertyFlags &flags)
{
- QScriptEngine *valueEngine = value.engine();
- if (valueEngine && (QScriptEnginePrivate::get(valueEngine) != engine)) {
+ QScriptEnginePrivate *valueEngine = QScriptValuePrivate::getEngine(value);
+ if (valueEngine && (valueEngine != engine)) {
qWarning("QScriptValue::setProperty(%s) failed: "
"cannot set value created in a different engine",
qPrintable(QString(id.ustring())));
@@ -443,22 +421,6 @@ void QScriptValuePrivate::setVariantValue(const QVariant &value)
static_cast<QScript::QVariantDelegate*>(delegate)->setValue(value);
}
-void QScriptValuePrivate::saveException(JSC::ExecState *exec, JSC::JSValue *val)
-{
- if (exec) {
- *val = exec->exception();
- exec->clearException();
- } else {
- *val = JSC::JSValue();
- }
-}
-
-void QScriptValuePrivate::restoreException(JSC::ExecState *exec, JSC::JSValue val)
-{
- if (exec && val)
- exec->setException(val);
-}
-
void QScriptValuePrivate::detachFromEngine()
{
if (isJSC())
@@ -822,8 +784,8 @@ void QScriptValue::setPrototype(const QScriptValue &prototype)
Q_D(QScriptValue);
if (!d || !d->isObject())
return;
- if (prototype.isValid() && prototype.engine()
- && (prototype.engine() != engine())) {
+ if (prototype.isValid() && QScriptValuePrivate::getEngine(prototype)
+ && (QScriptValuePrivate::getEngine(prototype) != d->engine)) {
qWarning("QScriptValue::setPrototype() failed: "
"cannot set a prototype created in "
"a different engine");
@@ -864,8 +826,8 @@ void QScriptValue::setScope(const QScriptValue &scope)
Q_D(QScriptValue);
if (!d || !d->isObject())
return;
- if (scope.isValid() && scope.engine()
- && (scope.engine() != engine())) {
+ if (scope.isValid() && QScriptValuePrivate::getEngine(scope)
+ && (QScriptValuePrivate::getEngine(scope) != d->engine)) {
qWarning("QScriptValue::setScope() failed: "
"cannot set a scope object created in "
"a different engine");
@@ -896,7 +858,7 @@ bool QScriptValue::instanceOf(const QScriptValue &other) const
Q_D(const QScriptValue);
if (!d || !d->isObject() || !other.isObject())
return false;
- if (other.engine() != engine()) {
+ if (QScriptValuePrivate::getEngine(other) != d->engine) {
qWarning("QScriptValue::instanceof: "
"cannot perform operation on a value created in "
"a different engine");
@@ -1083,10 +1045,12 @@ static bool Equals(QScriptValue lhs, QScriptValue rhs)
*/
bool QScriptValue::lessThan(const QScriptValue &other) const
{
+ Q_D(const QScriptValue);
// no equivalent function in JSC? There's a jsLess() in VM/Machine.cpp
if (!isValid() || !other.isValid())
return false;
- if (other.engine() && engine() && (other.engine() != engine())) {
+ if (QScriptValuePrivate::getEngine(other) && d->engine
+ && (QScriptValuePrivate::getEngine(other) != d->engine)) {
qWarning("QScriptValue::lessThan: "
"cannot compare to a value created in "
"a different engine");
@@ -1124,7 +1088,8 @@ bool QScriptValue::equals(const QScriptValue &other) const
Q_D(const QScriptValue);
if (!d || !other.d_ptr)
return (d_ptr == other.d_ptr);
- if (other.engine() && engine() && (other.engine() != engine())) {
+ if (QScriptValuePrivate::getEngine(other) && d->engine
+ && (QScriptValuePrivate::getEngine(other) != d->engine)) {
qWarning("QScriptValue::equals: "
"cannot compare to a value created in "
"a different engine");
@@ -1173,7 +1138,8 @@ bool QScriptValue::strictlyEquals(const QScriptValue &other) const
Q_D(const QScriptValue);
if (!d || !other.d_ptr)
return (d_ptr == other.d_ptr);
- if (other.engine() && engine() && (other.engine() != engine())) {
+ if (QScriptValuePrivate::getEngine(other) && d->engine
+ && (QScriptValuePrivate::getEngine(other) != d->engine)) {
qWarning("QScriptValue::strictlyEquals: "
"cannot compare to a value created in "
"a different engine");
@@ -1513,6 +1479,8 @@ QVariant QScriptValue::toVariant() const
#endif
else if (isArray())
return QScriptEnginePrivate::variantListFromArray(*this);
+ else if (QScriptDeclarativeClass *dc = QScriptDeclarativeClass::scriptClass(*this))
+ return dc->toVariant(QScriptDeclarativeClass::object(*this));
// try to convert to primitive
JSC::ExecState *exec = d->engine->currentFrame;
JSC::JSValue savedException;
@@ -1603,6 +1571,8 @@ QObject *QScriptValue::toQObject() const
if (isQObject()) {
QScriptObject *object = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
return static_cast<QScript::QObjectDelegate*>(object->delegate())->value();
+ } else if (QScriptDeclarativeClass *dc = QScriptDeclarativeClass::scriptClass(*this)) {
+ return dc->toQObject(QScriptDeclarativeClass::object(*this));
} else if (isVariant()) {
QVariant var = toVariant();
int type = var.userType();
@@ -1725,7 +1695,8 @@ void QScriptValue::setProperty(quint32 arrayIndex, const QScriptValue &value,
Q_D(QScriptValue);
if (!d || !d->isObject())
return;
- if (value.engine() && (value.engine() != engine())) {
+ if (QScriptValuePrivate::getEngine(value)
+ && (QScriptValuePrivate::getEngine(value) != d->engine)) {
qWarning("QScriptValue::setProperty() failed: "
"cannot set value created in a different engine");
return;
@@ -1775,7 +1746,7 @@ QScriptValue QScriptValue::property(const QScriptString &name,
const ResolveFlags &mode) const
{
Q_D(const QScriptValue);
- if (!d || !d->isObject() || !name.isValid())
+ if (!d || !d->isObject() || !QScriptStringPrivate::isValid(name))
return QScriptValue();
return d->property(name.d_ptr->identifier, mode);
}
@@ -1798,7 +1769,7 @@ void QScriptValue::setProperty(const QScriptString &name,
const PropertyFlags &flags)
{
Q_D(QScriptValue);
- if (!d || !d->isObject() || !name.isValid())
+ if (!d || !d->isObject() || !QScriptStringPrivate::isValid(name))
return;
d->setProperty(name.d_ptr->identifier, value, flags);
}
@@ -1832,7 +1803,7 @@ QScriptValue::PropertyFlags QScriptValue::propertyFlags(const QScriptString &nam
const ResolveFlags &mode) const
{
Q_D(const QScriptValue);
- if (!d || !d->isObject() || !name.isValid())
+ if (!d || !d->isObject() || !QScriptStringPrivate::isValid(name))
return 0;
return d->propertyFlags(name.d_ptr->identifier, mode);
}
@@ -1872,7 +1843,8 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject,
if (callType == JSC::CallTypeNone)
return QScriptValue();
- if (thisObject.engine() && (thisObject.engine() != engine())) {
+ if (QScriptValuePrivate::getEngine(thisObject)
+ && (QScriptValuePrivate::getEngine(thisObject) != d->engine)) {
qWarning("QScriptValue::call() failed: "
"cannot call function with thisObject created in "
"a different engine");
@@ -1890,7 +1862,8 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject,
const QScriptValue &arg = args.at(i);
if (!arg.isValid()) {
argsVector[i] = JSC::jsUndefined();
- } else if (arg.engine() && (arg.engine() != engine())) {
+ } else if (QScriptValuePrivate::getEngine(arg)
+ && (QScriptValuePrivate::getEngine(arg) != d->engine)) {
qWarning("QScriptValue::call() failed: "
"cannot call function with argument created in "
"a different engine");
@@ -1947,7 +1920,8 @@ QScriptValue QScriptValue::call(const QScriptValue &thisObject,
if (callType == JSC::CallTypeNone)
return QScriptValue();
- if (thisObject.engine() && (thisObject.engine() != engine())) {
+ if (QScriptValuePrivate::getEngine(thisObject)
+ && (QScriptValuePrivate::getEngine(thisObject) != d->engine)) {
qWarning("QScriptValue::call() failed: "
"cannot call function with thisObject created in "
"a different engine");
diff --git a/src/script/api/qscriptvalue.h b/src/script/api/qscriptvalue.h
index 32f7a436d8..0431ee54f8 100644
--- a/src/script/api/qscriptvalue.h
+++ b/src/script/api/qscriptvalue.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -70,6 +52,7 @@ typedef QList<QScriptValue> QScriptValueList;
typedef double qsreal;
class QScriptValuePrivate;
+class QScriptEnginePrivate;
struct QScriptValuePrivatePointerDeleter;
class Q_SCRIPT_EXPORT QScriptValue
{
@@ -226,6 +209,8 @@ private:
QExplicitlySharedDataPointer<QScriptValuePrivate> d_ptr;
Q_DECLARE_PRIVATE(QScriptValue)
+
+ friend class QScriptEnginePrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QScriptValue::ResolveFlags)
diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h
index 77b5084966..8211607f4d 100644
--- a/src/script/api/qscriptvalue_p.h
+++ b/src/script/api/qscriptvalue_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -81,7 +63,7 @@ public:
inline ~QScriptValuePrivate();
inline void initFrom(JSC::JSValue value);
- inline void initFrom(double value);
+ inline void initFrom(qsreal value);
inline void initFrom(const QString &value);
inline bool isJSC() const;
@@ -100,8 +82,17 @@ public:
return QScriptValue(d);
}
- QScriptValue property(const JSC::Identifier &id, int resolveMode) const;
- QScriptValue property(quint32 index, int resolveMode) const;
+ static inline QScriptEnginePrivate *getEngine(const QScriptValue &q)
+ {
+ if (!q.d_ptr)
+ return 0;
+ return q.d_ptr->engine;
+ }
+
+ inline QScriptValue property(const JSC::Identifier &id, int resolveMode) const;
+ QScriptValue propertyHelper(const JSC::Identifier &id, int resolveMode) const;
+ inline QScriptValue property(quint32 index, int resolveMode) const;
+ QScriptValue propertyHelper(quint32, int resolveMode) const;
inline QScriptValue property(const QString &, int resolveMode) const;
void setProperty(const JSC::Identifier &id, const QScriptValue &value,
const QScriptValue::PropertyFlags &flags);
@@ -118,13 +109,13 @@ public:
return -1;
}
- static void saveException(JSC::ExecState*, JSC::JSValue*);
- static void restoreException(JSC::ExecState*, JSC::JSValue);
+ static inline void saveException(JSC::ExecState*, JSC::JSValue*);
+ static inline void restoreException(JSC::ExecState*, JSC::JSValue);
QScriptEnginePrivate *engine;
Type type;
JSC::JSValue jscValue;
- double numberValue;
+ qsreal numberValue;
QString stringValue;
// linked list of engine's script values
diff --git a/src/script/api/qscriptvalueiterator.cpp b/src/script/api/qscriptvalueiterator.cpp
index cf27af67b4..03cb695fa4 100644
--- a/src/script/api/qscriptvalueiterator.cpp
+++ b/src/script/api/qscriptvalueiterator.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/api/qscriptvalueiterator.h b/src/script/api/qscriptvalueiterator.h
index 26ddbedaeb..946a322c74 100644
--- a/src/script/api/qscriptvalueiterator.h
+++ b/src/script/api/qscriptvalueiterator.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/bridge/bridge.pri b/src/script/bridge/bridge.pri
index 666a07e946..09e2dfbadb 100644
--- a/src/script/bridge/bridge.pri
+++ b/src/script/bridge/bridge.pri
@@ -5,7 +5,9 @@ SOURCES += \
$$PWD/qscriptvariant.cpp \
$$PWD/qscriptqobject.cpp \
$$PWD/qscriptglobalobject.cpp \
- $$PWD/qscriptactivationobject.cpp
+ $$PWD/qscriptactivationobject.cpp \
+ $$PWD/qscriptdeclarativeobject.cpp \
+ $$PWD/qscriptdeclarativeclass.cpp
HEADERS += \
$$PWD/qscriptfunction_p.h \
@@ -14,4 +16,6 @@ HEADERS += \
$$PWD/qscriptvariant_p.h \
$$PWD/qscriptqobject_p.h \
$$PWD/qscriptglobalobject_p.h \
- $$PWD/qscriptactivationobject_p.h
+ $$PWD/qscriptactivationobject_p.h \
+ $$PWD/qscriptdeclarativeobject_p.h \
+ $$PWD/qscriptdeclarativeclass_p.h
diff --git a/src/script/bridge/qscriptactivationobject.cpp b/src/script/bridge/qscriptactivationobject.cpp
index edccb3e3dd..80f4bf1b62 100644
--- a/src/script/bridge/qscriptactivationobject.cpp
+++ b/src/script/bridge/qscriptactivationobject.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/bridge/qscriptactivationobject_p.h b/src/script/bridge/qscriptactivationobject_p.h
index f313f90b2b..80d8c1eeb4 100644
--- a/src/script/bridge/qscriptactivationobject_p.h
+++ b/src/script/bridge/qscriptactivationobject_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/bridge/qscriptclassobject.cpp b/src/script/bridge/qscriptclassobject.cpp
index 0d885320d9..43ea5f9a36 100644
--- a/src/script/bridge/qscriptclassobject.cpp
+++ b/src/script/bridge/qscriptclassobject.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -70,17 +52,6 @@ ClassObjectDelegate::~ClassObjectDelegate()
{
}
-QScriptClass *ClassObjectDelegate::scriptClass() const
-{
- return m_scriptClass;
-}
-
-void ClassObjectDelegate::setScriptClass(QScriptClass *scriptClass)
-{
- Q_ASSERT(scriptClass != 0);
- m_scriptClass = scriptClass;
-}
-
QScriptObjectDelegate::Type ClassObjectDelegate::type() const
{
return ClassObject;
diff --git a/src/script/bridge/qscriptclassobject_p.h b/src/script/bridge/qscriptclassobject_p.h
index f5cce76a27..8ebde3a52d 100644
--- a/src/script/bridge/qscriptclassobject_p.h
+++ b/src/script/bridge/qscriptclassobject_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -70,8 +52,8 @@ public:
ClassObjectDelegate(QScriptClass *scriptClass);
~ClassObjectDelegate();
- QScriptClass *scriptClass() const;
- void setScriptClass(QScriptClass *scriptClass);
+ inline QScriptClass *scriptClass() const;
+ inline void setScriptClass(QScriptClass *scriptClass);
virtual Type type() const;
@@ -105,6 +87,17 @@ private:
QScriptClass *m_scriptClass;
};
+inline QScriptClass *ClassObjectDelegate::scriptClass() const
+{
+ return m_scriptClass;
+}
+
+inline void ClassObjectDelegate::setScriptClass(QScriptClass *scriptClass)
+{
+ Q_ASSERT(scriptClass != 0);
+ m_scriptClass = scriptClass;
+}
+
} // namespace QScript
QT_END_NAMESPACE
diff --git a/src/script/bridge/qscriptdeclarativeclass.cpp b/src/script/bridge/qscriptdeclarativeclass.cpp
new file mode 100644
index 0000000000..df00ce94bc
--- /dev/null
+++ b/src/script/bridge/qscriptdeclarativeclass.cpp
@@ -0,0 +1,339 @@
+/****************************************************************************
+**
+** 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-ONLY$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qscriptdeclarativeclass_p.h"
+#include "qscriptdeclarativeobject_p.h"
+#include "qscriptobject_p.h"
+#include <QtScript/qscriptstring.h>
+#include <QtScript/qscriptengine.h>
+#include <QtScript/qscriptengineagent.h>
+#include <private/qscriptengine_p.h>
+#include <private/qscriptvalue_p.h>
+#include <private/qscriptqobject_p.h>
+#include <private/qscriptactivationobject_p.h>
+#include <QtCore/qstringlist.h>
+
+QT_BEGIN_NAMESPACE
+
+QScriptDeclarativeClass::PersistentIdentifier::PersistentIdentifier()
+{
+ new (&d) JSC::Identifier();
+}
+
+QScriptDeclarativeClass::PersistentIdentifier::~PersistentIdentifier()
+{
+ ((JSC::Identifier &)d).JSC::Identifier::~Identifier();
+}
+
+QScriptDeclarativeClass::PersistentIdentifier::PersistentIdentifier(const PersistentIdentifier &other)
+{
+ identifier = other.identifier;
+ new (&d) JSC::Identifier((JSC::Identifier &)(other.d));
+}
+
+QScriptDeclarativeClass::PersistentIdentifier &
+QScriptDeclarativeClass::PersistentIdentifier::operator=(const PersistentIdentifier &other)
+{
+ identifier = other.identifier;
+ ((JSC::Identifier &)d) = (JSC::Identifier &)(other.d);
+ return *this;
+}
+
+QScriptDeclarativeClass::QScriptDeclarativeClass(QScriptEngine *engine)
+: d_ptr(new QScriptDeclarativeClassPrivate)
+{
+ Q_ASSERT(sizeof(void*) == sizeof(JSC::Identifier));
+ d_ptr->q_ptr = this;
+ d_ptr->engine = engine;
+}
+
+QScriptValue QScriptDeclarativeClass::newObject(QScriptEngine *engine,
+ QScriptDeclarativeClass *scriptClass,
+ Object *object)
+{
+ Q_ASSERT(engine);
+ Q_ASSERT(scriptClass);
+
+ QScriptEnginePrivate *p = static_cast<QScriptEnginePrivate *>(QObjectPrivate::get(engine));
+
+ JSC::ExecState* exec = p->currentFrame;
+ QScriptObject *result = new (exec) QScriptObject(p->scriptObjectStructure);
+ result->setDelegate(new QScript::DeclarativeObjectDelegate(scriptClass, object));
+ return p->scriptValueFromJSCValue(result);
+}
+
+QScriptDeclarativeClass *QScriptDeclarativeClass::scriptClass(const QScriptValue &v)
+{
+ QScriptValuePrivate *d = QScriptValuePrivate::get(v);
+ if (!d || !d->isJSC() || !d->jscValue.inherits(&QScriptObject::info))
+ return 0;
+ QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
+ QScriptObjectDelegate *delegate = scriptObject->delegate();
+ if (!delegate || (delegate->type() != QScriptObjectDelegate::DeclarativeClassObject))
+ return 0;
+ return static_cast<QScript::DeclarativeObjectDelegate*>(delegate)->scriptClass();
+}
+
+QScriptDeclarativeClass::Object *QScriptDeclarativeClass::object(const QScriptValue &v)
+{
+ QScriptValuePrivate *d = QScriptValuePrivate::get(v);
+ if (!d || !d->isJSC() || !d->jscValue.inherits(&QScriptObject::info))
+ return 0;
+ QScriptObject *scriptObject = static_cast<QScriptObject*>(JSC::asObject(d->jscValue));
+ QScriptObjectDelegate *delegate = scriptObject->delegate();
+ if (!delegate || (delegate->type() != QScriptObjectDelegate::DeclarativeClassObject))
+ return 0;
+ return static_cast<QScript::DeclarativeObjectDelegate*>(delegate)->object();
+}
+
+QScriptValue QScriptDeclarativeClass::function(const QScriptValue &v, const Identifier &name)
+{
+ QScriptValuePrivate *d = QScriptValuePrivate::get(v);
+
+ if (!d->isObject())
+ return QScriptValue();
+
+ JSC::ExecState *exec = d->engine->currentFrame;
+ JSC::JSObject *object = d->jscValue.getObject();
+ JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object));
+ JSC::JSValue result;
+
+ JSC::Identifier id(exec, (JSC::UString::Rep *)name);
+
+ if (const_cast<JSC::JSObject*>(object)->getOwnPropertySlot(exec, id, slot)) {
+ result = slot.getValue(exec, id);
+ if (QScript::isFunction(result))
+ return d->engine->scriptValueFromJSCValue(result);
+ }
+
+ return QScriptValue();
+}
+
+QScriptValue QScriptDeclarativeClass::property(const QScriptValue &v, const Identifier &name)
+{
+ QScriptValuePrivate *d = QScriptValuePrivate::get(v);
+
+ if (!d->isObject())
+ return QScriptValue();
+
+ JSC::ExecState *exec = d->engine->currentFrame;
+ JSC::JSObject *object = d->jscValue.getObject();
+ JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object));
+ JSC::JSValue result;
+
+ JSC::Identifier id(exec, (JSC::UString::Rep *)name);
+
+ if (const_cast<JSC::JSObject*>(object)->getOwnPropertySlot(exec, id, slot)) {
+ result = slot.getValue(exec, id);
+ return d->engine->scriptValueFromJSCValue(result);
+ }
+
+ return QScriptValue();
+}
+
+/*
+Returns the scope chain entry at \a index. If index is less than 0, returns
+entries starting at the end. For example, scopeChainValue(context, -1) will return
+the value last in the scope chain.
+*/
+QScriptValue QScriptDeclarativeClass::scopeChainValue(QScriptContext *context, int index)
+{
+ context->activationObject(); //ensure the creation of the normal scope for native context
+ const JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(context);
+ QScriptEnginePrivate *engine = QScript::scriptEngineFromExec(frame);
+
+ JSC::ScopeChainNode *node = frame->scopeChain();
+ JSC::ScopeChainIterator it(node);
+
+ if (index < 0) {
+ int count = 0;
+ for (it = node->begin(); it != node->end(); ++it)
+ ++count;
+
+ index = qAbs(index);
+ if (index > count)
+ return QScriptValue();
+ else
+ index = count - index;
+ }
+
+ for (it = node->begin(); it != node->end(); ++it) {
+
+ if (index == 0) {
+
+ JSC::JSObject *object = *it;
+ if (!object) return QScriptValue();
+
+ if (object->inherits(&QScript::QScriptActivationObject::info)
+ && (static_cast<QScript::QScriptActivationObject*>(object)->delegate() != 0)) {
+ // Return the object that property access is being delegated to
+ object = static_cast<QScript::QScriptActivationObject*>(object)->delegate();
+ }
+ return engine->scriptValueFromJSCValue(object);
+
+ } else {
+ --index;
+ }
+
+ }
+
+ return QScriptValue();
+}
+
+/*!
+ Enters a new execution context and returns the associated
+ QScriptContext object.
+
+ Once you are done with the context, you should call popContext() to
+ restore the old context.
+
+ By default, the `this' object of the new context is the Global Object.
+ The context's \l{QScriptContext::callee()}{callee}() will be invalid.
+
+ Unlike pushContext(), the default scope chain is reset to include
+ only the global object and the QScriptContext's activation object.
+
+ \sa QScriptEngine::popContext()
+*/
+QScriptContext * QScriptDeclarativeClass::pushCleanContext(QScriptEngine *engine)
+{
+ if (!engine)
+ return 0;
+
+ QScriptEnginePrivate *d = QScriptEnginePrivate::get(engine);
+
+ JSC::CallFrame* newFrame = d->pushContext(d->currentFrame,
+ d->currentFrame->globalData().dynamicGlobalObject,
+ JSC::ArgList(), /*callee = */0, false, true);
+
+ if (engine->agent())
+ engine->agent()->contextPush();
+
+ return d->contextForFrame(newFrame);
+}
+
+QScriptDeclarativeClass::~QScriptDeclarativeClass()
+{
+}
+
+QScriptEngine *QScriptDeclarativeClass::engine() const
+{
+ return d_ptr->engine;
+}
+
+QScriptDeclarativeClass::PersistentIdentifier
+QScriptDeclarativeClass::createPersistentIdentifier(const QString &str)
+{
+ QScriptEnginePrivate *p =
+ static_cast<QScriptEnginePrivate *>(QObjectPrivate::get(d_ptr->engine));
+ JSC::ExecState* exec = p->currentFrame;
+
+ PersistentIdentifier rv(true);
+ new (&rv.d) JSC::Identifier(exec, (UChar *)str.constData(), str.size());
+ rv.identifier = (void *)((JSC::Identifier &)rv.d).ustring().rep();
+ return rv;
+}
+
+QScriptDeclarativeClass::PersistentIdentifier
+QScriptDeclarativeClass::createPersistentIdentifier(const Identifier &id)
+{
+ QScriptEnginePrivate *p =
+ static_cast<QScriptEnginePrivate *>(QObjectPrivate::get(d_ptr->engine));
+ JSC::ExecState* exec = p->currentFrame;
+
+ PersistentIdentifier rv(true);
+ new (&rv.d) JSC::Identifier(exec, (JSC::UString::Rep *)id);
+ rv.identifier = (void *)((JSC::Identifier &)rv.d).ustring().rep();
+ return rv;
+}
+
+QString QScriptDeclarativeClass::toString(const Identifier &identifier)
+{
+ JSC::UString::Rep *r = (JSC::UString::Rep *)identifier;
+ return QString((QChar *)r->data(), r->size());
+}
+
+quint32 QScriptDeclarativeClass::toArrayIndex(const Identifier &identifier, bool *ok)
+{
+ JSC::UString::Rep *r = (JSC::UString::Rep *)identifier;
+ JSC::UString s(r);
+ return s.toArrayIndex(ok);
+}
+
+QScriptClass::QueryFlags
+QScriptDeclarativeClass::queryProperty(Object *object, const Identifier &name,
+ QScriptClass::QueryFlags flags)
+{
+ Q_UNUSED(object);
+ Q_UNUSED(name);
+ Q_UNUSED(flags);
+ return 0;
+}
+
+QScriptValue QScriptDeclarativeClass::property(Object *object, const Identifier &name)
+{
+ Q_UNUSED(object);
+ Q_UNUSED(name);
+ return QScriptValue();
+}
+
+void QScriptDeclarativeClass::setProperty(Object *object, const Identifier &name,
+ const QScriptValue &value)
+{
+ Q_UNUSED(object);
+ Q_UNUSED(name);
+ Q_UNUSED(value);
+}
+
+QScriptValue::PropertyFlags
+QScriptDeclarativeClass::propertyFlags(Object *object, const Identifier &name)
+{
+ Q_UNUSED(object);
+ Q_UNUSED(name);
+ return 0;
+}
+
+QStringList QScriptDeclarativeClass::propertyNames(Object *object)
+{
+ Q_UNUSED(object);
+ return QStringList();
+}
+
+QObject *QScriptDeclarativeClass::toQObject(Object *, bool *ok)
+{
+ if (ok) *ok = false;
+ return 0;
+}
+
+QVariant QScriptDeclarativeClass::toVariant(Object *, bool *ok)
+{
+ if (ok) *ok = false;
+ return QVariant();
+}
+
+QScriptContext *QScriptDeclarativeClass::context() const
+{
+ return d_ptr->context;
+}
+
+QT_END_NAMESPACE
diff --git a/src/script/bridge/qscriptdeclarativeclass_p.h b/src/script/bridge/qscriptdeclarativeclass_p.h
new file mode 100644
index 0000000000..40e5051e7e
--- /dev/null
+++ b/src/script/bridge/qscriptdeclarativeclass_p.h
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** 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-ONLY$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCRIPTDECLARATIVECLASS_P_H
+#define QSCRIPTDECLARATIVECLASS_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 <QtCore/qobjectdefs.h>
+#include <QtScript/qscriptvalue.h>
+#include <QtScript/qscriptclass.h>
+
+QT_BEGIN_NAMESPACE
+
+class QScriptDeclarativeClassPrivate;
+class PersistentIdentifierPrivate;
+class QScriptContext;
+class Q_SCRIPT_EXPORT QScriptDeclarativeClass
+{
+public:
+ typedef void* Identifier;
+
+ struct Object { virtual ~Object() {} };
+
+ static QScriptValue newObject(QScriptEngine *, QScriptDeclarativeClass *, Object *);
+ static QScriptDeclarativeClass *scriptClass(const QScriptValue &);
+ static Object *object(const QScriptValue &);
+
+ static QScriptValue function(const QScriptValue &, const Identifier &);
+ static QScriptValue property(const QScriptValue &, const Identifier &);
+
+ static QScriptValue scopeChainValue(QScriptContext *, int index);
+ static QScriptContext *pushCleanContext(QScriptEngine *);
+
+ class Q_SCRIPT_EXPORT PersistentIdentifier
+ {
+ public:
+ Identifier identifier;
+
+ PersistentIdentifier();
+ ~PersistentIdentifier();
+ PersistentIdentifier(const PersistentIdentifier &other);
+ PersistentIdentifier &operator=(const PersistentIdentifier &other);
+
+ private:
+ friend class QScriptDeclarativeClass;
+ PersistentIdentifier(bool) : identifier(0), d(0) {}
+ void *d;
+ };
+
+ QScriptDeclarativeClass(QScriptEngine *engine);
+ virtual ~QScriptDeclarativeClass();
+
+ QScriptEngine *engine() const;
+
+ PersistentIdentifier createPersistentIdentifier(const QString &);
+ PersistentIdentifier createPersistentIdentifier(const Identifier &);
+
+ QString toString(const Identifier &);
+ quint32 toArrayIndex(const Identifier &, bool *ok);
+
+ virtual QScriptClass::QueryFlags queryProperty(Object *, const Identifier &,
+ QScriptClass::QueryFlags flags);
+
+ virtual QScriptValue property(Object *, const Identifier &);
+ virtual void setProperty(Object *, const Identifier &name, const QScriptValue &);
+ virtual QScriptValue::PropertyFlags propertyFlags(Object *, const Identifier &);
+
+ virtual QStringList propertyNames(Object *);
+
+ virtual QObject *toQObject(Object *, bool *ok = 0);
+ virtual QVariant toVariant(Object *, bool *ok = 0);
+
+ QScriptContext *context() const;
+protected:
+ friend class QScriptDeclarativeClassPrivate;
+ QScopedPointer<QScriptDeclarativeClassPrivate> d_ptr;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/script/bridge/qscriptdeclarativeobject.cpp b/src/script/bridge/qscriptdeclarativeobject.cpp
new file mode 100644
index 0000000000..6b4f5cb886
--- /dev/null
+++ b/src/script/bridge/qscriptdeclarativeobject.cpp
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** 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-ONLY$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "config.h"
+#include "qscriptdeclarativeobject_p.h"
+
+#include "../api/qscriptengine.h"
+#include "../api/qscriptengine_p.h"
+#include "../api/qscriptcontext.h"
+#include "../api/qscriptcontext_p.h"
+#include "../api/qscriptclass.h"
+#include "../api/qscriptclasspropertyiterator.h"
+
+#include "Error.h"
+#include "PropertyNameArray.h"
+
+#include <QtCore/qstringlist.h>
+
+Q_DECLARE_METATYPE(QScriptContext*)
+Q_DECLARE_METATYPE(QScriptValue)
+Q_DECLARE_METATYPE(QScriptValueList)
+
+QT_BEGIN_NAMESPACE
+
+namespace QScript
+{
+
+DeclarativeObjectDelegate::DeclarativeObjectDelegate(QScriptDeclarativeClass *c,
+ QScriptDeclarativeClass::Object *o)
+: m_class(c), m_object(o)
+{
+}
+
+DeclarativeObjectDelegate::~DeclarativeObjectDelegate()
+{
+ delete m_object;
+}
+
+QScriptObjectDelegate::Type DeclarativeObjectDelegate::type() const
+{
+ return DeclarativeClassObject;
+}
+
+bool DeclarativeObjectDelegate::getOwnPropertySlot(QScriptObject* object,
+ JSC::ExecState *exec,
+ const JSC::Identifier &propertyName,
+ JSC::PropertySlot &slot)
+{
+ QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScriptDeclarativeClass::Identifier identifier = (void *)propertyName.ustring().rep();
+
+ QScriptDeclarativeClassPrivate *p = QScriptDeclarativeClassPrivate::get(m_class);
+ p->context = reinterpret_cast<QScriptContext *>(exec);
+ QScriptClass::QueryFlags flags =
+ m_class->queryProperty(m_object, identifier, QScriptClass::HandlesReadAccess);
+ if (flags & QScriptClass::HandlesReadAccess) {
+ QScriptValue value = m_class->property(m_object, identifier);
+ p->context = 0;
+ slot.setValue(engine->scriptValueToJSCValue(value));
+ return true;
+ }
+ p->context = 0;
+
+ return QScriptObjectDelegate::getOwnPropertySlot(object, exec, propertyName, slot);
+}
+
+void DeclarativeObjectDelegate::put(QScriptObject* object, JSC::ExecState *exec,
+ const JSC::Identifier &propertyName,
+ JSC::JSValue value, JSC::PutPropertySlot &slot)
+{
+ QScriptEnginePrivate *engine = scriptEngineFromExec(exec);
+ QScriptDeclarativeClass::Identifier identifier = (void *)propertyName.ustring().rep();
+
+ QScriptDeclarativeClassPrivate *p = QScriptDeclarativeClassPrivate::get(m_class);
+ p->context = reinterpret_cast<QScriptContext *>(exec);
+ QScriptClass::QueryFlags flags =
+ m_class->queryProperty(m_object, identifier, QScriptClass::HandlesWriteAccess);
+ if (flags & QScriptClass::HandlesWriteAccess) {
+ m_class->setProperty(m_object, identifier, engine->scriptValueFromJSCValue(value));
+ p->context = 0;
+ return;
+ }
+ p->context = 0;
+
+ QScriptObjectDelegate::put(object, exec, propertyName, value, slot);
+}
+
+bool DeclarativeObjectDelegate::deleteProperty(QScriptObject* object, JSC::ExecState *exec,
+ const JSC::Identifier &propertyName,
+ bool checkDontDelete)
+{
+ return QScriptObjectDelegate::deleteProperty(object, exec, propertyName, checkDontDelete);
+}
+
+bool DeclarativeObjectDelegate::getPropertyAttributes(const QScriptObject* object,
+ JSC::ExecState *exec,
+ const JSC::Identifier &propertyName,
+ unsigned &attribs) const
+{
+ QScriptDeclarativeClass::Identifier identifier = (void *)propertyName.ustring().rep();
+
+ QScriptClass::QueryFlags flags =
+ m_class->queryProperty(m_object, identifier, QScriptClass::HandlesReadAccess);
+ if (flags & QScriptClass::HandlesReadAccess) {
+ QScriptValue::PropertyFlags flags = m_class->propertyFlags(m_object, identifier);
+ attribs = 0;
+ if (flags & QScriptValue::ReadOnly)
+ attribs |= JSC::ReadOnly;
+ if (flags & QScriptValue::SkipInEnumeration)
+ attribs |= JSC::DontEnum;
+ if (flags & QScriptValue::Undeletable)
+ attribs |= JSC::DontDelete;
+ if (flags & QScriptValue::PropertyGetter)
+ attribs |= JSC::Getter;
+ if (flags & QScriptValue::PropertySetter)
+ attribs |= JSC::Setter;
+ attribs |= flags & QScriptValue::UserRange;
+ return true;
+ }
+ return QScriptObjectDelegate::getPropertyAttributes(object, exec, propertyName, attribs);
+}
+
+void DeclarativeObjectDelegate::getOwnPropertyNames(QScriptObject* object, JSC::ExecState *exec,
+ JSC::PropertyNameArray &propertyNames,
+ bool includeNonEnumerable)
+{
+ QStringList properties = m_class->propertyNames(m_object);
+ for (int ii = 0; ii < properties.count(); ++ii) {
+ const QString &name = properties.at(ii);
+ propertyNames.add(JSC::Identifier(exec, name));
+ }
+
+ QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, includeNonEnumerable);
+}
+
+JSC::CallType DeclarativeObjectDelegate::getCallData(QScriptObject *object, JSC::CallData &callData)
+{
+ return QScriptObjectDelegate::getCallData(object, callData);
+}
+
+JSC::ConstructType DeclarativeObjectDelegate::getConstructData(QScriptObject* object, JSC::ConstructData &constructData)
+{
+ return QScriptObjectDelegate::getConstructData(object, constructData);
+}
+
+bool DeclarativeObjectDelegate::hasInstance(QScriptObject* object, JSC::ExecState *exec,
+ JSC::JSValue value, JSC::JSValue proto)
+{
+ return QScriptObjectDelegate::hasInstance(object, exec, value, proto);
+}
+
+} // namespace QScript
+
+QT_END_NAMESPACE
diff --git a/src/script/bridge/qscriptdeclarativeobject_p.h b/src/script/bridge/qscriptdeclarativeobject_p.h
new file mode 100644
index 0000000000..2aa3fb0e32
--- /dev/null
+++ b/src/script/bridge/qscriptdeclarativeobject_p.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** 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-ONLY$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCRIPTDECLARATIVEOBJECT_P_H
+#define QSCRIPTDECLARATIVEOBJECT_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 <QtCore/qobjectdefs.h>
+
+#include "config.h"
+#include "qscriptobject_p.h"
+#include "qscriptdeclarativeclass_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QScriptClass;
+
+class QScriptDeclarativeClassPrivate
+{
+public:
+ QScriptDeclarativeClassPrivate() : engine(0), q_ptr(0), context(0) {}
+
+ QScriptEngine *engine;
+ QScriptDeclarativeClass *q_ptr;
+ QScriptContext *context;
+
+ static QScriptDeclarativeClassPrivate *get(QScriptDeclarativeClass *c) {
+ return c->d_ptr.data();
+ }
+};
+
+namespace QScript
+{
+
+class DeclarativeObjectDelegate : public QScriptObjectDelegate
+{
+public:
+ DeclarativeObjectDelegate(QScriptDeclarativeClass *c, QScriptDeclarativeClass::Object *o);
+ ~DeclarativeObjectDelegate();
+
+ virtual Type type() const;
+
+ QScriptDeclarativeClass *scriptClass() const { return m_class; }
+ QScriptDeclarativeClass::Object *object() const { return m_object; }
+
+ virtual bool getOwnPropertySlot(QScriptObject*, JSC::ExecState*,
+ const JSC::Identifier& propertyName,
+ JSC::PropertySlot&);
+ virtual void put(QScriptObject*, JSC::ExecState* exec,
+ const JSC::Identifier& propertyName,
+ JSC::JSValue, JSC::PutPropertySlot&);
+ virtual bool deleteProperty(QScriptObject*, JSC::ExecState*,
+ const JSC::Identifier& propertyName,
+ bool checkDontDelete = true);
+ virtual bool getPropertyAttributes(const QScriptObject*, JSC::ExecState*,
+ const JSC::Identifier&,
+ unsigned&) const;
+ virtual void getOwnPropertyNames(QScriptObject*, JSC::ExecState*,
+ JSC::PropertyNameArray&,
+ bool includeNonEnumerable = false);
+
+ virtual JSC::CallType getCallData(QScriptObject*, JSC::CallData&);
+ virtual JSC::ConstructType getConstructData(QScriptObject*, JSC::ConstructData&);
+
+ virtual bool hasInstance(QScriptObject*, JSC::ExecState*,
+ JSC::JSValue value, JSC::JSValue proto);
+
+private:
+ QScriptDeclarativeClass *m_class;
+ QScriptDeclarativeClass::Object *m_object;
+};
+
+} // namespace QScript
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/script/bridge/qscriptfunction.cpp b/src/script/bridge/qscriptfunction.cpp
index d3767bf362..e2e612003b 100644
--- a/src/script/bridge/qscriptfunction.cpp
+++ b/src/script/bridge/qscriptfunction.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/bridge/qscriptfunction_p.h b/src/script/bridge/qscriptfunction_p.h
index bfcd703506..10e3f4229a 100644
--- a/src/script/bridge/qscriptfunction_p.h
+++ b/src/script/bridge/qscriptfunction_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/bridge/qscriptglobalobject.cpp b/src/script/bridge/qscriptglobalobject.cpp
index c624a3102b..2217025c26 100644
--- a/src/script/bridge/qscriptglobalobject.cpp
+++ b/src/script/bridge/qscriptglobalobject.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/bridge/qscriptglobalobject_p.h b/src/script/bridge/qscriptglobalobject_p.h
index 01784c258d..9909afc8c6 100644
--- a/src/script/bridge/qscriptglobalobject_p.h
+++ b/src/script/bridge/qscriptglobalobject_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/bridge/qscriptobject.cpp b/src/script/bridge/qscriptobject.cpp
index 55644fe95a..2d71c43e4f 100644
--- a/src/script/bridge/qscriptobject.cpp
+++ b/src/script/bridge/qscriptobject.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -70,36 +52,6 @@ QScriptObject::~QScriptObject()
delete d;
}
-JSC::JSValue QScriptObject::data() const
-{
- if (!d)
- return JSC::JSValue();
- return d->data;
-}
-
-void QScriptObject::setData(JSC::JSValue data)
-{
- if (!d)
- d = new Data();
- d->data = data;
-}
-
-QScriptObjectDelegate *QScriptObject::delegate() const
-{
- if (!d)
- return 0;
- return d->delegate;
-}
-
-void QScriptObject::setDelegate(QScriptObjectDelegate *delegate)
-{
- if (!d)
- d = new Data();
- else
- delete d->delegate;
- d->delegate = delegate;
-}
-
bool QScriptObject::getOwnPropertySlot(JSC::ExecState* exec,
const JSC::Identifier& propertyName,
JSC::PropertySlot& slot)
diff --git a/src/script/bridge/qscriptobject_p.h b/src/script/bridge/qscriptobject_p.h
index c1cee31845..a4faa06d58 100644
--- a/src/script/bridge/qscriptobject_p.h
+++ b/src/script/bridge/qscriptobject_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -104,11 +86,11 @@ public:
return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, JSC::ImplementsHasInstance | JSC::OverridesHasInstance));
}
- JSC::JSValue data() const;
- void setData(JSC::JSValue data);
+ inline JSC::JSValue data() const;
+ inline void setData(JSC::JSValue data);
- QScriptObjectDelegate *delegate() const;
- void setDelegate(QScriptObjectDelegate *delegate);
+ inline QScriptObjectDelegate *delegate() const;
+ inline void setDelegate(QScriptObjectDelegate *delegate);
protected:
Data *d;
@@ -127,7 +109,8 @@ public:
enum Type {
QtObject,
Variant,
- ClassObject
+ ClassObject,
+ DeclarativeClassObject
};
QScriptObjectDelegate();
@@ -158,6 +141,36 @@ private:
Q_DISABLE_COPY(QScriptObjectDelegate)
};
+inline JSC::JSValue QScriptObject::data() const
+{
+ if (!d)
+ return JSC::JSValue();
+ return d->data;
+}
+
+inline void QScriptObject::setData(JSC::JSValue data)
+{
+ if (!d)
+ d = new Data();
+ d->data = data;
+}
+
+inline QScriptObjectDelegate *QScriptObject::delegate() const
+{
+ if (!d)
+ return 0;
+ return d->delegate;
+}
+
+inline void QScriptObject::setDelegate(QScriptObjectDelegate *delegate)
+{
+ if (!d)
+ d = new Data();
+ else
+ delete d->delegate;
+ d->delegate = delegate;
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/script/bridge/qscriptqobject.cpp b/src/script/bridge/qscriptqobject.cpp
index 345489fa65..559fcd38e6 100644
--- a/src/script/bridge/qscriptqobject.cpp
+++ b/src/script/bridge/qscriptqobject.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
@@ -1190,6 +1172,7 @@ bool QObjectDelegate::getOwnPropertySlot(QScriptObject *object, JSC::ExecState *
const JSC::Identifier &propertyName,
JSC::PropertySlot &slot)
{
+#ifndef QT_NO_PROPERTIES
QByteArray name = QString(propertyName.ustring()).toLatin1();
QObject *qobject = data->value;
if (!qobject) {
@@ -1296,12 +1279,16 @@ bool QObjectDelegate::getOwnPropertySlot(QScriptObject *object, JSC::ExecState *
}
return QScriptObjectDelegate::getOwnPropertySlot(object, exec, propertyName, slot);
+#else //QT_NO_PROPERTIES
+ return false;
+#endif //QT_NO_PROPERTIES
}
void QObjectDelegate::put(QScriptObject *object, JSC::ExecState* exec,
const JSC::Identifier& propertyName,
JSC::JSValue value, JSC::PutPropertySlot &slot)
{
+#ifndef QT_NO_PROPERTIES
QByteArray name = ((QString)propertyName.ustring()).toLatin1();
QObject *qobject = data->value;
if (!qobject) {
@@ -1392,12 +1379,14 @@ void QObjectDelegate::put(QScriptObject *object, JSC::ExecState* exec,
}
QScriptObjectDelegate::put(object, exec, propertyName, value, slot);
+#endif //QT_NO_PROPERTIES
}
bool QObjectDelegate::deleteProperty(QScriptObject *object, JSC::ExecState *exec,
const JSC::Identifier& propertyName,
bool checkDontDelete)
{
+#ifndef QT_NO_PROPERTIES
QByteArray name = ((QString)propertyName.ustring()).toLatin1();
QObject *qobject = data->value;
if (!qobject) {
@@ -1436,6 +1425,9 @@ bool QObjectDelegate::deleteProperty(QScriptObject *object, JSC::ExecState *exec
}
return QScriptObjectDelegate::deleteProperty(object, exec, propertyName, checkDontDelete);
+#else //QT_NO_PROPERTIES
+ return false;
+#endif //QT_NO_PROPERTIES
}
bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object,
@@ -1443,6 +1435,7 @@ bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object,
const JSC::Identifier &propertyName,
unsigned &attributes) const
{
+#ifndef QT_NO_PROPERTIES
// ### try to avoid duplicating logic from getOwnPropertySlot()
QByteArray name = ((QString)propertyName.ustring()).toLatin1();
QObject *qobject = data->value;
@@ -1511,12 +1504,16 @@ bool QObjectDelegate::getPropertyAttributes(const QScriptObject *object,
}
return QScriptObjectDelegate::getPropertyAttributes(object, exec, propertyName, attributes);
+#else //QT_NO_PROPERTIES
+ return false;
+#endif //QT_NO_PROPERTIES
}
void QObjectDelegate::getOwnPropertyNames(QScriptObject *object, JSC::ExecState *exec,
JSC::PropertyNameArray &propertyNames,
bool includeNonEnumerable)
{
+#ifndef QT_NO_PROPERTIES
QObject *qobject = data->value;
if (!qobject) {
QString message = QString::fromLatin1("cannot get property names of deleted QObject");
@@ -1560,6 +1557,7 @@ void QObjectDelegate::getOwnPropertyNames(QScriptObject *object, JSC::ExecState
}
QScriptObjectDelegate::getOwnPropertyNames(object, exec, propertyNames, includeNonEnumerable);
+#endif //QT_NO_PROPERTIES
}
void QObjectDelegate::markChildren(QScriptObject *object, JSC::MarkStack& markStack)
diff --git a/src/script/bridge/qscriptqobject_p.h b/src/script/bridge/qscriptqobject_p.h
index 2d482ccc59..41900b5766 100644
--- a/src/script/bridge/qscriptqobject_p.h
+++ b/src/script/bridge/qscriptqobject_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/bridge/qscriptvariant.cpp b/src/script/bridge/qscriptvariant.cpp
index 725f4e0b73..cc5df9a9b7 100644
--- a/src/script/bridge/qscriptvariant.cpp
+++ b/src/script/bridge/qscriptvariant.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/bridge/qscriptvariant_p.h b/src/script/bridge/qscriptvariant_p.h
index 445ca69e5e..81312e80a6 100644
--- a/src/script/bridge/qscriptvariant_p.h
+++ b/src/script/bridge/qscriptvariant_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/parser/make-parser.sh b/src/script/parser/make-parser.sh
new file mode 100755
index 0000000000..d0c71fb8bf
--- /dev/null
+++ b/src/script/parser/make-parser.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+#############################################################################
+##
+## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+## All rights reserved.
+## Contact: Nokia Corporation (qt-info@nokia.com)
+##
+## This file is the build configuration utility 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$
+##
+#############################################################################
+
+me=$(dirname $0)
+mkdir -p $me/out
+(cd $me/out && ../../../../util/qlalr/qlalr --qt --no-lines ../qscript.g)
+
+for f in $me/out/*.h $me/out/*.cpp; do
+ n=$(basename $f)
+ cp $f $n
+done
+
+git diff .
+
diff --git a/src/script/parser/qscript.g b/src/script/parser/qscript.g
index b0b0cdf9ba..2d617134d2 100644
--- a/src/script/parser/qscript.g
+++ b/src/script/parser/qscript.g
@@ -6,35 +6,17 @@
--
-- This file is part of the QtScript 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.
---
+-- $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.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$
--
----------------------------------------------------------------------------
@@ -78,8 +60,7 @@
%start Program
-/.
-/****************************************************************************
+/./****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
@@ -87,12 +68,24 @@
**
** This file is part of the QtScript 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.
-** 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.
+**
+** 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.
@@ -108,20 +101,13 @@
**
****************************************************************************/
+// This file was generated by qlalr - DO NOT EDIT!
+
+
#include <QtCore/QtDebug>
#include <string.h>
-#include "qscriptengine.h"
-#include "qscriptengine_p.h"
-#include "qscriptvalueimpl_p.h"
-#include "qscriptcontext_p.h"
-#include "qscriptmember_p.h"
-#include "qscriptobject_p.h"
-#include "qscriptlexer_p.h"
-#include "qscriptast_p.h"
-#include "qscriptnodepool_p.h"
-
#define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \
node->startLine = startloc.startLine; \
node->startColumn = startloc.startColumn; \
@@ -131,8 +117,7 @@
./
-/:
-/****************************************************************************
+/:/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
@@ -140,10 +125,25 @@
**
** This file is part of the QtScript 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.
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this
+**
+** 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.
**
@@ -153,10 +153,14 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
+// This file was generated by qlalr - DO NOT EDIT!
+
+
//
// W A R N I N G
// -------------
diff --git a/src/script/parser/qscriptast.cpp b/src/script/parser/qscriptast.cpp
index 29d35571dd..c2ba81b330 100644
--- a/src/script/parser/qscriptast.cpp
+++ b/src/script/parser/qscriptast.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/parser/qscriptast_p.h b/src/script/parser/qscriptast_p.h
index 5f687eb370..921c9d8159 100644
--- a/src/script/parser/qscriptast_p.h
+++ b/src/script/parser/qscriptast_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/parser/qscriptastfwd_p.h b/src/script/parser/qscriptastfwd_p.h
index 620128debf..3b38303ece 100644
--- a/src/script/parser/qscriptastfwd_p.h
+++ b/src/script/parser/qscriptastfwd_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/parser/qscriptastvisitor.cpp b/src/script/parser/qscriptastvisitor.cpp
index 1e5117847e..256d4c34ec 100644
--- a/src/script/parser/qscriptastvisitor.cpp
+++ b/src/script/parser/qscriptastvisitor.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/parser/qscriptastvisitor_p.h b/src/script/parser/qscriptastvisitor_p.h
index dc8a76f991..9985485413 100644
--- a/src/script/parser/qscriptastvisitor_p.h
+++ b/src/script/parser/qscriptastvisitor_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/parser/qscriptgrammar.cpp b/src/script/parser/qscriptgrammar.cpp
index cbb1ab8380..03eb526d5c 100644
--- a/src/script/parser/qscriptgrammar.cpp
+++ b/src/script/parser/qscriptgrammar.cpp
@@ -1,4 +1,3 @@
-// This file was generated by qlalr - DO NOT EDIT!
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
@@ -7,39 +6,22 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
+// This file was generated by qlalr - DO NOT EDIT!
#include "qscriptgrammar_p.h"
QT_BEGIN_NAMESPACE
@@ -68,7 +50,7 @@ const char *const QScriptGrammar::spell [] = {
#endif // QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
};
-const int QScriptGrammar::lhs [] = {
+const short QScriptGrammar::lhs [] = {
85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
85, 85, 85, 85, 85, 87, 87, 92, 92, 86,
86, 89, 89, 93, 93, 93, 93, 94, 94, 94,
@@ -97,7 +79,7 @@ const int QScriptGrammar::lhs [] = {
163, 97, 167, 167, 164, 164, 165, 165, 168, 84,
169, 169, 170, 170, 166, 166, 88, 88, 171};
-const int QScriptGrammar:: rhs[] = {
+const short QScriptGrammar::rhs [] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 3,
3, 5, 3, 4, 3, 2, 4, 1, 2, 0,
1, 3, 5, 1, 1, 1, 1, 1, 1, 1,
@@ -429,7 +411,7 @@ const int QScriptGrammar::rule_index [] = {
803, 805, 808, 810, 812, 813, 815, 816, 818};
#endif // QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
-const int QScriptGrammar::action_default [] = {
+const short QScriptGrammar::action_default [] = {
0, 98, 165, 129, 137, 133, 173, 180, 77, 149,
179, 187, 175, 125, 0, 176, 264, 62, 177, 178,
183, 78, 141, 145, 66, 95, 76, 81, 61, 0,
@@ -478,7 +460,7 @@ const int QScriptGrammar::action_default [] = {
15, 88, 86, 90, 87, 85, 89, 204, 197, 0,
205, 201, 0, 203, 193, 0, 194, 198};
-const int QScriptGrammar::goto_default [] = {
+const short QScriptGrammar::goto_default [] = {
29, 28, 439, 437, 113, 112, 14, 2, 438, 111,
114, 194, 24, 17, 190, 26, 8, 201, 21, 27,
77, 25, 1, 32, 30, 270, 13, 264, 3, 260,
@@ -489,7 +471,7 @@ const int QScriptGrammar::goto_default [] = {
460, 324, 395, 399, 402, 398, 397, 417, 418, 16,
100, 107, 96, 99, 106, 108, 33, 0};
-const int QScriptGrammar::action_index [] = {
+const short QScriptGrammar::action_index [] = {
1318, 79, -84, 56, 39, -17, -84, -84, 169, -84,
-84, -84, -84, 216, 149, -84, -84, -84, -84, -84,
-84, 475, 68, 100, 180, 184, -84, -84, -84, 99,
@@ -586,7 +568,7 @@ const int QScriptGrammar::action_index [] = {
-88, -88, -88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, 5, -88, -88, -56, -88, -88};
-const int QScriptGrammar::action_info [] = {
+const short QScriptGrammar::action_info [] = {
305, 307, 109, 400, 400, 400, 273, 105, 416, 302,
297, 295, 293, 423, 273, 151, 313, 321, 406, 407,
424, 295, 422, 198, 420, 149, 313, 353, -47, 396,
@@ -777,7 +759,7 @@ const int QScriptGrammar::action_info [] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
-const int QScriptGrammar::action_check [] = {
+const short QScriptGrammar::action_check [] = {
61, 60, 55, 5, 5, 5, 1, 33, 33, 61,
8, 76, 48, 29, 1, 8, 2, 29, 55, 7,
60, 76, 36, 8, 20, 7, 2, 16, 7, 33,
diff --git a/src/script/parser/qscriptgrammar_p.h b/src/script/parser/qscriptgrammar_p.h
index 9e0f4f824d..b75ee16112 100644
--- a/src/script/parser/qscriptgrammar_p.h
+++ b/src/script/parser/qscriptgrammar_p.h
@@ -6,44 +6,21 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
-// This file was generated by qlalr - DO NOT EDIT!
-
-#ifndef QSCRIPTGRAMMAR_P_H
-#define QSCRIPTGRAMMAR_P_H
-
//
// W A R N I N G
// -------------
@@ -55,6 +32,10 @@
// We mean it.
//
+// This file was generated by qlalr - DO NOT EDIT!
+#ifndef QSCRIPTGRAMMAR_P_H
+#define QSCRIPTGRAMMAR_P_H
+
#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
@@ -159,33 +140,28 @@ public:
GOTO_CHECK_OFFSET = 1562
};
- static const char *const spell [];
- static const int lhs [];
- static const int rhs [];
+ static const char *const spell [];
+ static const short lhs [];
+ static const short rhs [];
#ifndef QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
static const int rule_index [];
static const int rule_info [];
#endif // QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
- 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 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)
@@ -199,6 +175,7 @@ public:
}
};
-QT_END_NAMESPACE
+QT_END_NAMESPACE
#endif // QSCRIPTGRAMMAR_P_H
+
diff --git a/src/script/parser/qscriptlexer.cpp b/src/script/parser/qscriptlexer.cpp
index 5080d10882..e62add1d1b 100644
--- a/src/script/parser/qscriptlexer.cpp
+++ b/src/script/parser/qscriptlexer.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/parser/qscriptlexer_p.h b/src/script/parser/qscriptlexer_p.h
index b3777675ec..d2096ad9f0 100644
--- a/src/script/parser/qscriptlexer_p.h
+++ b/src/script/parser/qscriptlexer_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/parser/qscriptparser.cpp b/src/script/parser/qscriptparser.cpp
index 197a486be6..509c4b1953 100644
--- a/src/script/parser/qscriptparser.cpp
+++ b/src/script/parser/qscriptparser.cpp
@@ -1,5 +1,3 @@
-// This file was generated by qlalr - DO NOT EDIT!
-
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
@@ -8,45 +6,28 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
+// This file was generated by qlalr - DO NOT EDIT!
+
+
#include <QtCore/QtDebug>
#include <string.h>
-#include "qscriptast_p.h"
-
#define Q_SCRIPT_UPDATE_POSITION(node, startloc, endloc) do { \
node->startLine = startloc.startLine; \
node->startColumn = startloc.startColumn; \
@@ -1136,9 +1117,9 @@ case 266: {
error_message += QLatin1String (", ");
first = false;
- error_message += QLatin1Char('`');
+ error_message += QLatin1String("`");
error_message += QLatin1String (spell [expected_tokens [s]]);
- error_message += QLatin1Char('\'');
+ error_message += QLatin1String("'");
}
}
diff --git a/src/script/parser/qscriptparser_p.h b/src/script/parser/qscriptparser_p.h
index 5f62db74eb..2a42b411ba 100644
--- a/src/script/parser/qscriptparser_p.h
+++ b/src/script/parser/qscriptparser_p.h
@@ -6,41 +6,24 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
// This file was generated by qlalr - DO NOT EDIT!
+
//
// W A R N I N G
// -------------
diff --git a/src/script/parser/qscriptsyntaxchecker.cpp b/src/script/parser/qscriptsyntaxchecker.cpp
index 925669570d..3503b61c1d 100644
--- a/src/script/parser/qscriptsyntaxchecker.cpp
+++ b/src/script/parser/qscriptsyntaxchecker.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/parser/qscriptsyntaxchecker_p.h b/src/script/parser/qscriptsyntaxchecker_p.h
index edc4b5972d..1c502e9297 100644
--- a/src/script/parser/qscriptsyntaxchecker_p.h
+++ b/src/script/parser/qscriptsyntaxchecker_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/utils/qscriptdate.cpp b/src/script/utils/qscriptdate.cpp
index 9e402b07d9..a6106dba0c 100644
--- a/src/script/utils/qscriptdate.cpp
+++ b/src/script/utils/qscriptdate.cpp
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/
diff --git a/src/script/utils/qscriptdate_p.h b/src/script/utils/qscriptdate_p.h
index 15bac00b50..f7205279a1 100644
--- a/src/script/utils/qscriptdate_p.h
+++ b/src/script/utils/qscriptdate_p.h
@@ -6,35 +6,17 @@
**
** This file is part of the QtScript 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.
-**
+** $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.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$
**
****************************************************************************/