Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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#ifndef QV4SCRIPT_H
4#define QV4SCRIPT_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include "qv4global_p.h"
18#include "qv4engine_p.h"
19#include "qv4functionobject_p.h"
20#include "qv4qmlcontext_p.h"
21#include "private/qv4compilercontext_p.h"
22
23#include <QQmlError>
24
26
27class QQmlContextData;
28
29namespace QQmlJS {
30class Engine;
31}
32
33namespace QV4 {
34
35struct Q_QML_EXPORT Script {
36 Script(ExecutionContext *scope, QV4::Compiler::ContextType mode, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
37 : sourceFile(source), line(line), column(column), sourceCode(sourceCode)
38 , context(scope), strictMode(false), inheritContext(false), parsed(false), contextType(mode)
39 , parseAsBinding(false) {}
40 Script(ExecutionEngine *engine, QmlContext *qml, bool parseAsBinding, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0)
41 : sourceFile(source), line(line), column(column), sourceCode(sourceCode)
42 , context(engine->rootContext()), strictMode(false), inheritContext(true), parsed(false)
43 , parseAsBinding(parseAsBinding) {
44 if (qml)
45 qmlContext.set(engine, *qml);
46 }
47 Script(ExecutionEngine *engine, QmlContext *qml, const QQmlRefPointer<ExecutableCompilationUnit> &compilationUnit);
48 ~Script();
50 int line;
51 int column;
56 bool parsed;
59 QQmlRefPointer<ExecutableCompilationUnit> compilationUnit;
62
63 void parse();
64 ReturnedValue run(const QV4::Value *thisObject = nullptr);
65
67
68 static QQmlRefPointer<QV4::CompiledData::CompilationUnit> precompile(
69 QV4::Compiler::Module *module, QQmlJS::Engine *jsEngine,
70 Compiler::JSUnitGenerator *unitGenerator, const QString &fileName,
71 const QString &finalUrl, const QString &source,
72 QList<QQmlError> *reportedErrors = nullptr,
74 static Script *createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, const QUrl &originalUrl, QString *error);
75};
76
77}
78
80
81#endif
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
quint64 ReturnedValue
static void * context
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction function
DBusConnection const char DBusError * error
GLenum mode
GLsizei GLsizei GLchar * source
GLenum GLenum GLsizei void GLsizei void * column
QQmlContext * qmlContext(const QObject *obj)
Definition qqml.cpp:75
QJSEngine engine
[0]
Script(ExecutionContext *scope, QV4::Compiler::ContextType mode, const QString &sourceCode, const QString &source=QString(), int line=1, int column=0)
Definition qv4script_p.h:36
QV4::PersistentValue qmlContext
Definition qv4script_p.h:58
bool parseAsBinding
Definition qv4script_p.h:61
bool strictMode
Definition qv4script_p.h:54
QString sourceCode
Definition qv4script_p.h:52
ExecutionContext * context
Definition qv4script_p.h:53
bool inheritContext
Definition qv4script_p.h:55
QString sourceFile
Definition qv4script_p.h:49
QQmlRefPointer< ExecutableCompilationUnit > compilationUnit
Definition qv4script_p.h:59
Script(ExecutionEngine *engine, QmlContext *qml, bool parseAsBinding, const QString &sourceCode, const QString &source=QString(), int line=1, int column=0)
Definition qv4script_p.h:40
QV4::WriteBarrier::Pointer< Function > vmFunction
Definition qv4script_p.h:60