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
qqmljscompiler.cpp File Reference

(8bf5aae19b77b618f3f7a55a59e87c8a319475a8)

#include "qqmljscompiler_p.h"
#include <private/qqmlirbuilder_p.h>
#include <private/qqmljsbasicblocks_p.h>
#include <private/qqmljscodegenerator_p.h>
#include <private/qqmljsfunctioninitializer_p.h>
#include <private/qqmljsimportvisitor_p.h>
#include <private/qqmljslexer_p.h>
#include <private/qqmljsloadergenerator_p.h>
#include <private/qqmljsoptimizations_p.h>
#include <private/qqmljsparser_p.h>
#include <private/qqmljsshadowcheck_p.h>
#include <private/qqmljsstoragegeneralizer_p.h>
#include <private/qqmljstypepropagator_p.h>
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qloggingcategory.h>
#include <QtQml/private/qqmlsignalnames_p.h>
#include <limits>
+ Include dependency graph for qqmljscompiler.cpp:

Go to the source code of this file.

Classes

class  BindingOrFunction
 

Functions

 Q_LOGGING_CATEGORY (lcAotCompiler, "qt.qml.compiler.aot", QtFatalMsg)
 
static QSet< QStringgetIllegalNames ()
 
 Q_GLOBAL_STATIC_WITH_ARGS (QSet< QString >, illegalNames,(getIllegalNames()))
 
static QString diagnosticErrorMessage (const QString &fileName, const QQmlJS::DiagnosticMessage &m)
 
static void annotateListElements (QmlIR::Document *document)
 
static bool checkArgumentsObjectUseInSignalHandlers (const QmlIR::Document &doc, QQmlJSCompileError *error)
 
bool qCompileQmlFile (const QString &inputFileName, QQmlJSSaveFunction saveFunction, QQmlJSAotCompiler *aotCompiler, QQmlJSCompileError *error, bool storeSourceLocation, QV4::Compiler::CodegenWarningInterface *interface, const QString *fileContents)
 
bool qCompileQmlFile (QmlIR::Document &irDocument, const QString &inputFileName, QQmlJSSaveFunction saveFunction, QQmlJSAotCompiler *aotCompiler, QQmlJSCompileError *error, bool storeSourceLocation, QV4::Compiler::CodegenWarningInterface *interface, const QString *fileContents)
 
bool qCompileJSFile (const QString &inputFileName, const QString &inputFileUrl, QQmlJSSaveFunction saveFunction, QQmlJSCompileError *error)
 
bool qSaveQmlJSUnitAsCpp (const QString &inputFileName, const QString &outputFileName, const QV4::CompiledData::SaveableUnitPointer &unit, const QQmlJSAotFunctionMap &aotFunctions, QString *errorString)
 
static bool isStrict (const QmlIR::Document *doc)
 

Variables

static const int FileScopeCodeIndex = -1
 
static const char * funcHeaderCode
 

Function Documentation

◆ annotateListElements()

static void annotateListElements ( QmlIR::Document * document)
static

Definition at line 89 of file qqmljscompiler.cpp.

References QString::isEmpty(), QmlIR::Binding::next, QStringLiteral, and QV4::CompiledData::Binding::Type_Script.

Referenced by qCompileQmlFile().

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

◆ checkArgumentsObjectUseInSignalHandlers()

static bool checkArgumentsObjectUseInSignalHandlers ( const QmlIR::Document & doc,
QQmlJSCompileError * error )
static

Definition at line 121 of file qqmljscompiler.cpp.

References QV4::Compiler::Context::ArgumentsObjectUsed, error, QV4::Compiler::Module::functions, QQmlSignalNames::isHandlerName(), QmlIR::Document::jsModule, QString::number(), QmlIR::Document::objects, QmlIR::Document::stringAt(), and QV4::CompiledData::Binding::Type_Script.

Referenced by qCompileQmlFile().

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

◆ diagnosticErrorMessage()

static QString diagnosticErrorMessage ( const QString & fileName,
const QQmlJS::DiagnosticMessage & m )
static

Definition at line 58 of file qqmljscompiler.cpp.

References fileName, and QString::number().

Referenced by QQmlJSCompileError::appendDiagnostic(), and qCompileQmlFile().

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

◆ getIllegalNames()

static QSet< QString > getIllegalNames ( )
static

Definition at line 35 of file qqmljscompiler.cpp.

References QString::fromLatin1(), and QV4::Compiler::Codegen::s_globalNames.

+ Here is the call graph for this function:

◆ isStrict()

static bool isStrict ( const QmlIR::Document * doc)
static

Definition at line 641 of file qqmljscompiler.cpp.

References QmlIR::Document::pragmas, and QmlIR::Pragma::Strict.

Referenced by QQmlJSAotCompiler::diagnose(), and QV4::EvalFunction::evalCall().

+ Here is the caller graph for this function:

◆ Q_GLOBAL_STATIC_WITH_ARGS()

Q_GLOBAL_STATIC_WITH_ARGS ( QSet< QString > ,
illegalNames ,
(getIllegalNames())  )

◆ Q_LOGGING_CATEGORY()

Q_LOGGING_CATEGORY ( lcAotCompiler ,
"qt.qml.compiler.aot" ,
QtFatalMsg  )

◆ qCompileJSFile()

bool qCompileJSFile ( const QString & inputFileName,
const QString & inputFileUrl,
QQmlJSSaveFunction saveFunction,
QQmlJSCompileError * error )

Definition at line 375 of file qqmljscompiler.cpp.

References QV4::Compiler::Codegen::compileModule(), QString::endsWith(), engine, error, QString::fromUtf8(), QRandomGenerator::generate(), generator, QFileDevice::NoError, Q_ASSERT, qScopeGuard(), QStringLiteral, QIODeviceBase::ReadOnly, QV4::Compiler::ScriptImportedByQML, QQmlJS::Lexer::setCode(), and url.

+ Here is the call graph for this function:

◆ qCompileQmlFile() [1/2]

bool qCompileQmlFile ( const QString & inputFileName,
QQmlJSSaveFunction saveFunction,
QQmlJSAotCompiler * aotCompiler,
QQmlJSCompileError * error,
bool storeSourceLocation,
QV4::Compiler::CodegenWarningInterface * interface,
const QString * fileContents )

Definition at line 181 of file qqmljscompiler.cpp.

References error, interface, and qCompileQmlFile().

Referenced by QQmlJSLinter::lintFile(), and qCompileQmlFile().

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

◆ qCompileQmlFile() [2/2]

bool qCompileQmlFile ( QmlIR::Document & irDocument,
const QString & inputFileName,
QQmlJSSaveFunction saveFunction,
QQmlJSAotCompiler * aotCompiler,
QQmlJSCompileError * error,
bool storeSourceLocation,
QV4::Compiler::CodegenWarningInterface * interface,
const QString * fileContents )

◆ qSaveQmlJSUnitAsCpp()

bool qSaveQmlJSUnitAsCpp ( const QString & inputFileName,
const QString & outputFileName,
const QV4::CompiledData::SaveableUnitPointer & unit,
const QQmlJSAotFunctionMap & aotFunctions,
QString * errorString )

Definition at line 469 of file qqmljscompiler.cpp.

References arg, begin(), QByteArray::constData(), FileScopeCodeIndex, QString::fromUtf8(), funcHeaderCode, Qt::hex(), it, QByteArrayLiteral, qQmlJSSymbolNamespaceForPath(), QStringLiteral, QV4::CompiledData::SaveableUnitPointer::saveToDisk(), QString::toUtf8(), QIODeviceBase::Truncate, QIODeviceBase::WriteOnly, and writeStr().

+ Here is the call graph for this function:

Variable Documentation

◆ FileScopeCodeIndex

const int FileScopeCodeIndex = -1
static

Definition at line 33 of file qqmljscompiler.cpp.

Referenced by qCompileQmlFile(), and qSaveQmlJSUnitAsCpp().

◆ funcHeaderCode

const char* funcHeaderCode
static
Initial value:
= R"(
[](const QQmlPrivate::AOTCompiledContext *aotContext, void **argv) {
Q_UNUSED(aotContext)
Q_UNUSED(argv)
)"

Definition at line 463 of file qqmljscompiler.cpp.

Referenced by qSaveQmlJSUnitAsCpp().