Debian Codegraph @

src/script/api/qscriptprogram.cpp

raw symbols SCIP
1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Contact: http://www.qt.io/licensing/
5 **
6 ** This file is part of the QtScript module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39
40 #include "config.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/config.h`/
41 #include "qscriptprogram.h"cxx . . $ `<file>/src/script/api/qscriptprogram.h`/
42 #include "qscriptprogram_p.h"cxx . . $ `<file>/src/script/api/qscriptprogram_p.h`/
43 #include "qscriptengine.h"cxx . . $ `<file>/src/script/api/qscriptengine.h`/
44 #include "qscriptengine_p.h"cxx . . $ `<file>/src/script/api/qscriptengine_p.h`/
45
46 #include "SamplingTool.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/bytecode/SamplingTool.h`/
47 #include "Executable.h"cxx . . $ `<file>/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Executable.h`/
48
49 QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`!
50
51 /*!
52 \since 4.7
53 \class QScriptProgram
54 \inmodule QtScript
55 \brief The QScriptProgram class encapsulates a Qt Script program.
56
57 \ingroup script
58
59 QScriptProgram retains the compiled representation of the script if
60 possible. Thus, QScriptProgram can be used to evaluate the same
61 script multiple times more efficiently.
62
63 \code
64 QScriptEngine engine;
65 QScriptProgram program("1 + 2");
66 QScriptValue result = engine.evaluate(program);
67 \endcode
68 */
69
70 QScriptProgramPrivatecxx . . $ QScriptProgramPrivate#::QScriptProgramPrivatecxx . . $ QScriptProgramPrivate#QScriptProgramPrivate(f82ba06e06e49bd2).(const QStringcxx . . $ QString# &src,
71 const QStringcxx . . $ QString# &fn,
72 int ln)
73 : sourceCodecxx . . $ QScriptProgramPrivate#sourceCode.(src), fileNamecxx . . $ QScriptProgramPrivate#fileName.(fn), firstLineNumbercxx . . $ QScriptProgramPrivate#firstLineNumber.(ln),
74 enginecxx . . $ QScriptProgramPrivate#engine.(0), _executable(0), sourceIdcxx . . $ QScriptProgramPrivate#sourceId.(-1), isCompiledcxx . . $ QScriptProgramPrivate#isCompiled.(false)
75 {
76 }
77
78 QScriptProgramPrivatecxx . . $ QScriptProgramPrivate#::~cxx . . $ QScriptProgramPrivate#`~QScriptProgramPrivate`(49f6e7a06ebc5aa8).QScriptProgramPrivatecxx . . $ QScriptProgramPrivate#()
79 {
80 if (enginecxx . . $ QScriptProgramPrivate#engine.) {
81 QScriptcxx . . $ QScript/::APIShimcxx . . $ QScript/APIShim# shimcxx . . $ QScript/APIShim#APIShim(db35ed4eaf341aaa).(enginecxx . . $ QScriptProgramPrivate#engine.);
82 _executable.clear();
83 enginecxx . . $ QScriptProgramPrivate#engine.->unregisterScriptProgramcxx . . $ QScriptEnginePrivate#unregisterScriptProgram(540f8febf2c9e5fe).(this);
84 }
85 }
86
87 QScriptProgramPrivatecxx . . $ QScriptProgramPrivate# *QScriptProgramPrivatecxx . . $ QScriptProgramPrivate#::getcxx . . $ QScriptProgramPrivate#get(e971b826c2bbe394).(const QScriptProgramcxx . . $ QScriptProgram# &q)
88 {
89 return const_cast<QScriptProgramPrivatecxx . . $ QScriptProgramPrivate#*>(q.d_funccxx . . $ QScriptProgram#d_func(16cbe843e51d3180).());
90 }
91
92 JSCcxx . . $ `<built-in>:463:9`!::EvalExecutablecxx . . $ QTJSC/EvalExecutable# *QScriptProgramPrivatecxx . . $ QScriptProgramPrivate#::executablecxx . . $ QScriptProgramPrivate#executable(9144bc997e9a12c9).(JSCcxx . . $ `<built-in>:463:9`!::ExecStatecxx . . $ QTJSC/ExecState# *exec,
93 QScriptEnginePrivatecxx . . $ QScriptEnginePrivate# *eng)
94 {
95 if (_executable) {
96 if (eng == engine)
97 return _executable.get();
98 // "Migrating" to another engine; clean up old state
99 QScriptcxx . . $ QScript/::APIShimcxx . . $ QScript/APIShim# shimcxx . . $ QScript/APIShim#APIShim(db35ed4eaf341aaa).(enginecxx . . $ QScriptProgramPrivate#engine.);
100 _executable.clear();
101 enginecxx . . $ QScriptProgramPrivate#engine.->unregisterScriptProgramcxx . . $ QScriptEnginePrivate#unregisterScriptProgram(540f8febf2c9e5fe).(this);
102 }
103 WTFcxx . . $ `<built-in>:467:9`!::PassRefPtrcxx . . $ QTWTF/PassRefPtr#<QScriptcxx . . $ QScript/::UStringSourceProviderWithFeedbackcxx . . $ QScript/UStringSourceProviderWithFeedback#> provider
104 = QScript::UStringSourceProviderWithFeedback::create(sourceCode, fileName, firstLineNumber, eng);
105 sourceIdcxx . . $ QScriptProgramPrivate#sourceId. = provider->asID();
106 JSCcxx . . $ `<built-in>:463:9`!::SourceCodecxx . . $ QTJSC/SourceCode# source(provider, firstLineNumbercxx . . $ QScriptProgramPrivate#firstLineNumber.); //after construction of SourceCode provider variable will be null.
107 _executable = JSCcxx . . $ `<built-in>:463:9`!::EvalExecutable::create(exec, source);
108 enginecxx . . $ QScriptProgramPrivate#engine. = eng;
109 enginecxx . . $ QScriptProgramPrivate#engine.->registerScriptProgramcxx . . $ QScriptEnginePrivate#registerScriptProgram(540f8febf2c9e5fe).(this);
110 isCompiledcxx . . $ QScriptProgramPrivate#isCompiled. = false;
111 return _executable.get();
112 }
113
114 void QScriptProgramPrivatecxx . . $ QScriptProgramPrivate#::detachFromEnginecxx . . $ QScriptProgramPrivate#detachFromEngine(49f6e7a06ebc5aa8).()
115 {
116 _executable.clear();
117 sourceIdcxx . . $ QScriptProgramPrivate#sourceId. = -1;
118 isCompiledcxx . . $ QScriptProgramPrivate#isCompiled. = false;
119 enginecxx . . $ QScriptProgramPrivate#engine. = 0;
120 }
121
122 /*!
123 Constructs a null QScriptProgram.
124 */
125 QScriptProgramcxx . . $ QScriptProgram#::QScriptProgramcxx . . $ QScriptProgram#QScriptProgram(49f6e7a06ebc5aa8).()
126 : d_ptr(0)
127 {
128 }
129
130 /*!
131 Constructs a new QScriptProgram with the given \a sourceCode, \a
132 fileName and \a firstLineNumber.
133 */
134 QScriptProgramcxx . . $ QScriptProgram#::QScriptProgramcxx . . $ QScriptProgram#QScriptProgram(80ce810550d92531).(const QStringcxx . . $ QString# &sourceCode,
135 const QStringcxx . . $ QString# fileName,
136 int firstLineNumber)
137 : d_ptr(new QScriptProgramPrivate(sourceCode, fileName, firstLineNumber))
138 {
139 }
140
141 /*!
142 Constructs a new QScriptProgram that is a copy of \a other.
143 */
144 QScriptProgramcxx . . $ QScriptProgram#::QScriptProgramcxx . . $ QScriptProgram#QScriptProgram(207f4dc4fdfc94e1).(const QScriptProgramcxx . . $ QScriptProgram# &other)
145 : d_ptr(other.d_ptr)
146 {
147 }
148
149 /*!
150 Destroys this QScriptProgram.
151 */
152 QScriptProgramcxx . . $ QScriptProgram#::~cxx . . $ QScriptProgram#`~QScriptProgram`(49f6e7a06ebc5aa8).QScriptProgramcxx . . $ QScriptProgram#()
153 {
154 }
155
156 /*!
157 Assigns the \a other value to this QScriptProgram.
158 */
159 QScriptProgramcxx . . $ QScriptProgram# &QScriptProgramcxx . . $ QScriptProgram#::operatorcxx . . $ QScriptProgram#`operator=`(78a35b6e3f7ff1f7).=(const QScriptProgramcxx . . $ QScriptProgram# &other)
160 {
161 d_ptr = other.d_ptr;
162 return *this;
163 }
164
165 /*!
166 Returns true if this QScriptProgram is null; otherwise
167 returns false.
168 */
169 bool QScriptProgramcxx . . $ QScriptProgram#::isNullcxx . . $ QScriptProgram#isNull(50ce9a9e25b4a850).() const
170 {
171 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptProgram);
172 return (d == 0);
173 }
174
175 /*!
176 Returns the source code of this program.
177 */
178 QStringcxx . . $ QString# QScriptProgramcxx . . $ QScriptProgram#::sourceCodecxx . . $ QScriptProgram#sourceCode(6ef7b6c27b00b43d).() const
179 {
180 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptProgram);
181 if (!d)
182 return QStringcxx . . $ QString#QString(e1217c004a86c950).();
183 return dcxx . . $ QString#QString(3520e46b33348bf6).->sourceCodecxx . . $ QScriptProgramPrivate#sourceCode.;
184 }
185
186 /*!
187 Returns the filename associated with this program.
188 */
189 QStringcxx . . $ QString# QScriptProgramcxx . . $ QScriptProgram#::fileNamecxx . . $ QScriptProgram#fileName(6ef7b6c27b00b43d).() const
190 {
191 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptProgram);
192 if (!d)
193 return QStringcxx . . $ QString#QString(e1217c004a86c950).();
194 return dcxx . . $ QString#QString(3520e46b33348bf6).->fileNamecxx . . $ QScriptProgramPrivate#fileName.;
195 }
196
197 /*!
198 Returns the line number associated with this program.
199 */
200 int QScriptProgramcxx . . $ QScriptProgram#::firstLineNumbercxx . . $ QScriptProgram#firstLineNumber(455f465bc33b4cdf).() const
201 {
202 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptProgram);
203 if (!d)
204 return -1;
205 return d->firstLineNumbercxx . . $ QScriptProgramPrivate#firstLineNumber.;
206 }
207
208 /*!
209 Returns true if this QScriptProgram is equal to \a other;
210 otherwise returns false.
211 */
212 bool QScriptProgramcxx . . $ QScriptProgram#::operatorcxx . . $ QScriptProgram#`operator==`(83c603f76ca3474f).==(const QScriptProgramcxx . . $ QScriptProgram# &other) const
213 {
214 Q_Dcxx . . $ `<external>/15045578679651060896/qglobal.h:1177:9`!(const QScriptProgram);
215 if (d == other.d_funccxx . . $ QScriptProgram#d_func(16cbe843e51d3180).())
216 return true;
217 return (sourceCodecxx . . $ QScriptProgram#sourceCode(6ef7b6c27b00b43d).() ==cxx . . $ `operator==`(edf9e4f73813982f). other.sourceCodecxx . . $ QScriptProgram#sourceCode(6ef7b6c27b00b43d).())
218 && (fileNamecxx . . $ QScriptProgram#fileName(6ef7b6c27b00b43d).() ==cxx . . $ `operator==`(edf9e4f73813982f). other.fileNamecxx . . $ QScriptProgram#fileName(6ef7b6c27b00b43d).())
219 && (firstLineNumbercxx . . $ QScriptProgram#firstLineNumber(455f465bc33b4cdf).() == other.firstLineNumbercxx . . $ QScriptProgram#firstLineNumber(455f465bc33b4cdf).());
220 }
221
222 /*!
223 Returns true if this QScriptProgram is not equal to \a other;
224 otherwise returns false.
225 */
226 bool QScriptProgramcxx . . $ QScriptProgram#::operatorcxx . . $ QScriptProgram#`operator!=`(83c603f76ca3474f).!=(const QScriptProgramcxx . . $ QScriptProgram# &other) const
227 {
228 return !operator==(other);
229 }
230
231 QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`!