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
QV4::Script Struct Reference

#include <qv4script_p.h>

+ Collaboration diagram for QV4::Script:

Public Member Functions

 Script (ExecutionContext *scope, QV4::Compiler::ContextType mode, const QString &sourceCode, const QString &source=QString(), int line=1, int column=0)
 
 Script (ExecutionEngine *engine, QmlContext *qml, bool parseAsBinding, const QString &sourceCode, const QString &source=QString(), int line=1, int column=0)
 
 Script (ExecutionEngine *engine, QmlContext *qml, const QQmlRefPointer< ExecutableCompilationUnit > &compilationUnit)
 
 ~Script ()
 
void parse ()
 
ReturnedValue run (const QV4::Value *thisObject=nullptr)
 
Functionfunction ()
 

Static Public Member Functions

static QQmlRefPointer< QV4::CompiledData::CompilationUnitprecompile (QV4::Compiler::Module *module, QQmlJS::Engine *jsEngine, Compiler::JSUnitGenerator *unitGenerator, const QString &fileName, const QString &finalUrl, const QString &source, QList< QQmlError > *reportedErrors=nullptr, QV4::Compiler::ContextType contextType=QV4::Compiler::ContextType::Global)
 
static ScriptcreateFromFileOrCache (ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, const QUrl &originalUrl, QString *error)
 

Public Attributes

QString sourceFile
 
int line
 
int column
 
QString sourceCode
 
ExecutionContextcontext
 
bool strictMode
 
bool inheritContext
 
bool parsed
 
QV4::Compiler::ContextType contextType = QV4::Compiler::ContextType::Eval
 
QV4::PersistentValue qmlContext
 
QQmlRefPointer< ExecutableCompilationUnitcompilationUnit
 
QV4::WriteBarrier::Pointer< FunctionvmFunction
 
bool parseAsBinding
 

Detailed Description

Definition at line 35 of file qv4script_p.h.

Constructor & Destructor Documentation

◆ Script() [1/3]

QV4::Script::Script ( ExecutionContext * scope,
QV4::Compiler::ContextType mode,
const QString & sourceCode,
const QString & source = QString(),
int line = 1,
int column = 0 )
inline

Definition at line 36 of file qv4script_p.h.

◆ Script() [2/3]

QV4::Script::Script ( ExecutionEngine * engine,
QmlContext * qml,
bool parseAsBinding,
const QString & sourceCode,
const QString & source = QString(),
int line = 1,
int column = 0 )
inline

Definition at line 40 of file qv4script_p.h.

References engine, and qmlContext().

+ Here is the call graph for this function:

◆ Script() [3/3]

Script::Script ( ExecutionEngine * engine,
QmlContext * qml,
const QQmlRefPointer< ExecutableCompilationUnit > & compilationUnit )

Definition at line 27 of file qv4script.cpp.

References compilationUnit, parsed, qmlContext, QV4::PersistentValue::set(), and vmFunction.

+ Here is the call graph for this function:

◆ ~Script()

Script::~Script ( )

Definition at line 40 of file qv4script.cpp.

Member Function Documentation

◆ createFromFileOrCache()

Script * Script::createFromFileOrCache ( ExecutionEngine * engine,
QmlContext * qmlContext,
const QString & fileName,
const QUrl & originalUrl,
QString * error )
static

Definition at line 184 of file qv4script.cpp.

References QQmlMetaType::AcceptUntyped, QV4::ExecutionEngine::Aot, QV4::ExecutionEngine::AotByteCode, engine, error, fileName, QQmlMetaType::findCachedCompilationUnit(), QString::fromUtf8(), QQmlMetaType::NoError, qmlContext, QIODeviceBase::ReadOnly, QQmlMetaType::RequireFullyTyped, QV4::Compiler::ScriptImportedByQML, sourceCode, and QQmlMetaType::VersionMismatch.

Referenced by QV4Include::method_include().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ function()

Function * Script::function ( )

Definition at line 130 of file qv4script.cpp.

References parse(), parsed, and vmFunction.

Referenced by QV4::EvalFunction::evalCall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse()

◆ precompile()

QQmlRefPointer< QV4::CompiledData::CompilationUnit > Script::precompile ( QV4::Compiler::Module * module,
QQmlJS::Engine * jsEngine,
Compiler::JSUnitGenerator * unitGenerator,
const QString & fileName,
const QString & finalUrl,
const QString & source,
QList< QQmlError > * reportedErrors = nullptr,
QV4::Compiler::ContextType contextType = QV4::Compiler::ContextType::Global )
static

Definition at line 137 of file qv4script.cpp.

References contextType, error, QV4::Compiler::Codegen::error(), fileName, QV4::Compiler::Codegen::generateCompilationUnit(), QV4::Compiler::Codegen::generateFromProgram(), QV4::Compiler::Codegen::hasError(), QQmlEnginePrivate::qmlErrorFromDiagnostics(), QQmlJS::Lexer::setCode(), and QV4::Compiler::Codegen::url().

Referenced by QQmlScriptBlob::dataReceived().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ run()

ReturnedValue Script::run ( const QV4::Value * thisObject = nullptr)

Definition at line 109 of file qv4script.cpp.

References context, engine, QV4::Managed::engine(), QJSEngine::globalObject(), QV4::PersistentValue::isUndefined(), parse(), parsed, qmlContext, QV4::Encode::undefined(), QV4::PersistentValue::value(), and vmFunction.

Referenced by QQmlJavaScriptExpression::evalFunction(), QJSEngine::evaluate(), and JavaScriptJob::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ column

int QV4::Script::column

Definition at line 51 of file qv4script_p.h.

◆ compilationUnit

QQmlRefPointer<ExecutableCompilationUnit> QV4::Script::compilationUnit

Definition at line 59 of file qv4script_p.h.

Referenced by Script(), and parse().

◆ context

ExecutionContext* QV4::Script::context

Definition at line 53 of file qv4script_p.h.

Referenced by parse(), and run().

◆ contextType

Definition at line 57 of file qv4script_p.h.

Referenced by parse(), and precompile().

◆ inheritContext

bool QV4::Script::inheritContext

◆ line

int QV4::Script::line

Definition at line 50 of file qv4script_p.h.

Referenced by parse().

◆ parseAsBinding

bool QV4::Script::parseAsBinding

Definition at line 61 of file qv4script_p.h.

Referenced by parse().

◆ parsed

bool QV4::Script::parsed

Definition at line 56 of file qv4script_p.h.

Referenced by Script(), function(), parse(), and run().

◆ qmlContext

QV4::PersistentValue QV4::Script::qmlContext

Definition at line 58 of file qv4script_p.h.

Referenced by Script(), createFromFileOrCache(), and run().

◆ sourceCode

QString QV4::Script::sourceCode

Definition at line 52 of file qv4script_p.h.

Referenced by createFromFileOrCache(), and parse().

◆ sourceFile

QString QV4::Script::sourceFile

Definition at line 49 of file qv4script_p.h.

Referenced by parse().

◆ strictMode

bool QV4::Script::strictMode

◆ vmFunction

QV4::WriteBarrier::Pointer<Function> QV4::Script::vmFunction

The documentation for this struct was generated from the following files: