Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4script_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant
4
#
ifndef
QV4SCRIPT_H
5
#
define
QV4SCRIPT_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
private
/
qv4compilercontext_p
.
h
>
19
#
include
<
private
/
qv4engine_p
.
h
>
20
#
include
<
private
/
qv4global_p
.
h
>
21
#
include
<
private
/
qv4qmlcontext_p
.
h
>
22
23
#
include
<
QtQml
/
qqmlerror
.
h
>
24
25
QT_BEGIN_NAMESPACE
26
27
class
QQmlContextData;
28
29
namespace
QQmlJS
{
30
class
Engine
;
31
}
32
33
namespace
QV4
{
34
35
struct
Q_QML_EXPORT
Script
36
{
37
enum
class
InheritContext
{
No
,
Yes
};
38
static
QQmlRefPointer
<
QV4
::
CompiledData
::
CompilationUnit
>
precompile
(
39
QV4
::
Compiler
::
Module
*
module
,
QQmlJS
::
Engine
*
jsEngine
,
40
Compiler
::
JSUnitGenerator
*
unitGenerator
,
const
QString
&
fileName
,
41
const
QString
&
source
,
QList
<
QQmlError
> *
reportedErrors
=
nullptr
,
42
QV4
::
Compiler
::
ContextType
contextType
=
QV4
::
Compiler
::
ContextType
::
Global
,
43
InheritContext
inheritContext
=
InheritContext
::
No
);
44
45
Script
(
46
ExecutionContext
*
scope
,
QV4
::
Compiler
::
ContextType
mode
,
const
QString
&
sourceCode
,
47
const
QString
&
source
=
QString
(),
int
line
= 1)
48
:
m_sourceFile
(
source
)
49
,
m_sourceCode
(
sourceCode
)
50
,
m_context
(
scope
)
51
,
m_line
(
line
)
52
,
m_contextType
(
mode
)
53
{}
54
55
Script
(
56
ExecutionEngine
*
engine
,
QmlContext
*
qml
,
bool
parseAsBinding
,
const
QString
&
sourceCode
,
57
const
QString
&
source
=
QString
(),
int
line
= 1)
58
:
m_sourceFile
(
source
)
59
,
m_sourceCode
(
sourceCode
)
60
,
m_context
(
engine
->
rootContext
())
61
,
m_line
(
line
)
62
,
m_parseAsBinding
(
parseAsBinding
)
63
,
m_inheritContext
(
true
)
64
{
65
if
(
qml
)
66
m_qmlContext
.
set
(
engine
, *
qml
);
67
}
68
69
Script
(
70
ExecutionEngine
*
engine
,
QmlContext
*
qml
,
71
const
QQmlRefPointer
<
ExecutableCompilationUnit
> &
compilationUnit
);
72
73
~
Script
();
74
75
void
setStrictMode
(
bool
strictMode
=
true
) {
m_strictMode
=
strictMode
; }
76
void
setInheritContext
(
bool
inheritContext
=
true
) {
m_inheritContext
=
inheritContext
; }
77
void
setParseAsBinding
(
bool
parseAsBinding
=
true
) {
m_parseAsBinding
=
parseAsBinding
; }
78
QQmlRefPointer
<
ExecutableCompilationUnit
>
compilationUnit
()
const
{
return
m_compilationUnit
; }
79
80
void
parse
();
81
ReturnedValue
run
(
const
QV4
::
Value
*
thisObject
=
nullptr
);
82
83
Function
*
function
();
84
85
private
:
86
QString
m_sourceFile
;
87
QString
m_sourceCode
;
88
QV4
::
PersistentValue
m_qmlContext
;
89
QQmlRefPointer
<
ExecutableCompilationUnit
>
m_compilationUnit
;
90
QV4
::
WriteBarrier
::
Pointer
<
Function
>
m_vmFunction
;
91
92
ExecutionContext
*
m_context
=
nullptr
;
93
94
int
m_line
= 1;
95
QV4
::
Compiler
::
ContextType
m_contextType
=
QV4
::
Compiler
::
ContextType
::
Eval
;
96
97
bool
m_strictMode
=
false
;
98
bool
m_parseAsBinding
=
false
;
99
bool
m_inheritContext
=
false
;
100
bool
m_parsed
=
false
;
101
};
102
103
}
104
105
QT_END_NAMESPACE
106
107
#
endif
QQmlJS::Engine
Definition
qqmljsengine_p.h:61
QPlatformGraphicsBufferHelper
\inmodule QtGui
QQmlJS
Definition
qv4bytecodegenerator_p.h:26
QV4
Definition
qjsvalue.h:23
QV4::Script
Definition
qv4script_p.h:36
qtdeclarative
src
qml
jsruntime
qv4script_p.h
Generated on
for Qt by
1.14.0