![]() |
Qt 6.x
The Qt SDK
|
#include <qv4compilercontext_p.h>
Classes | |
struct | KeyValuePair |
struct | Member |
class | PropertyDependencyMap |
struct | ResolvedName |
class | SmallSet |
struct | SourceLocationTable |
Public Types | |
enum | MemberType { UndefinedMember , ThisFunctionName , VariableDefinition , VariableDeclaration , FunctionDefinition } |
enum | UsesArgumentsObject { ArgumentsObjectUnknown , ArgumentsObjectNotUsed , ArgumentsObjectUsed } |
typedef QMap< QString, Member > | MemberMap |
Public Member Functions | |
Context (Context *parent, ContextType type) | |
bool | hasArgument (const QString &name) const |
int | findArgument (const QString &name, bool *isInjected) const |
Member | findMember (const QString &name) const |
bool | memberInfo (const QString &name, const Member **m) const |
bool | requiresImplicitReturnValue () const |
void | addUsedVariable (const QString &name) |
bool | addLocalVar (const QString &name, MemberType contextType, QQmlJS::AST::VariableScope scope, QQmlJS::AST::FunctionExpression *function=nullptr, const QQmlJS::SourceLocation &declarationLocation=QQmlJS::SourceLocation(), bool isInjected=false) |
ResolvedName | resolveName (const QString &name, const QQmlJS::SourceLocation &accessLocation) |
void | emitBlockHeader (Compiler::Codegen *codegen) |
void | emitBlockFooter (Compiler::Codegen *codegen) |
void | setupFunctionIndices (Moth::BytecodeGenerator *bytecodeGenerator) |
bool | canHaveTailCalls () const |
bool | isCaseBlock () const |
Definition at line 132 of file qv4compilercontext_p.h.
typedef QMap<QString, Member> QV4::Compiler::Context::MemberMap |
Definition at line 171 of file qv4compilercontext_p.h.
Enumerator | |
---|---|
UndefinedMember | |
ThisFunctionName | |
VariableDefinition | |
VariableDeclaration | |
FunctionDefinition |
Definition at line 141 of file qv4compilercontext_p.h.
Enumerator | |
---|---|
ArgumentsObjectUnknown | |
ArgumentsObjectNotUsed | |
ArgumentsObjectUsed |
Definition at line 213 of file qv4compilercontext_p.h.
|
inline |
Definition at line 265 of file qv4compilercontext_p.h.
bool Context::addLocalVar | ( | const QString & | name, |
Context::MemberType | type, | ||
QQmlJS::AST::VariableScope | scope, | ||
QQmlJS::AST::FunctionExpression * | function = nullptr , |
||
const QQmlJS::SourceLocation & | declarationLocation = QQmlJS::SourceLocation() , |
||
bool | isInjected = false |
||
) |
Definition at line 54 of file qv4compilercontext.cpp.
References addLocalVar(), QV4::Compiler::Block, caughtVariable, QQmlJS::AST::FormalParameterList::containsName(), contextType, QMap< Key, T >::end(), QMap< Key, T >::find(), formals, function, FunctionDefinition, QMap< Key, T >::insert(), isCatchBlock, it, members, and parent.
Referenced by addLocalVar(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), and QV4::Compiler::ScanFunctions::visit().
Definition at line 318 of file qv4compilercontext_p.h.
References QSet< T >::insert(), and usedVariables.
Referenced by QV4::Compiler::ScanFunctions::visit().
|
inline |
Definition at line 353 of file qv4compilercontext_p.h.
References QV4::Compiler::Block, canHaveTailCalls(), contextType, QV4::Compiler::Function, isGenerator, isStrict, and parent.
Referenced by canHaveTailCalls(), and QV4::Compiler::Codegen::defineFunction().
void Context::emitBlockFooter | ( | Compiler::Codegen * | codegen | ) |
Definition at line 286 of file qv4compilercontext.cpp.
References QV4::Moth::BytecodeGenerator::addInstruction(), contextType, QV4::Compiler::ESModule, QV4::Compiler::Codegen::generator(), QV4::Compiler::Global, QT_WARNING_DISABLE_GCC, QT_WARNING_POP, QT_WARNING_PUSH, requiresExecutionContext, and QV4::Compiler::ScriptImportedByQML.
Referenced by QV4::Compiler::ControlFlowBlock::~ControlFlowBlock(), QV4::Compiler::ControlFlowCatch::~ControlFlowCatch(), and QV4::Compiler::Codegen::defineFunction().
void Context::emitBlockHeader | ( | Compiler::Codegen * | codegen | ) |
Definition at line 174 of file qv4compilercontext.cpp.
References QV4::Moth::BytecodeGenerator::addInstruction(), ArgumentsObjectUsed, QMap< Key, T >::begin(), QV4::Compiler::Binding, QV4::Compiler::Block, blockIndex, QV4::Compiler::Module::blocks, caughtVariable, QMap< Key, T >::constBegin(), QMap< Key, T >::constEnd(), contextType, convert(), QV4::Compiler::Codegen::defineFunction(), QMap< Key, T >::end(), QV4::Compiler::ESModule, QV4::Compiler::Eval, formals, function, QV4::CallData::Function, QV4::Compiler::Function, QV4::Compiler::Codegen::generator(), QV4::Compiler::Global, innerFunctionAccessesNewTarget, innerFunctionAccessesThis, isCatchBlock, QQmlJS::AST::FormalParameterList::isSimpleParameterList(), isStrict, it, load(), QV4::Compiler::Codegen::loadClosure(), members, QV4::Compiler::Codegen::module(), QV4::CallData::NewTarget, nRegisters, Q_ASSERT, QStringLiteral, QV4::Compiler::Codegen::referenceForName(), registerOffset, QV4::Compiler::Codegen::registerString(), requiresExecutionContext, QV4::Compiler::ScriptImportedByQML, setupFunctionIndices(), sizeOfRegisterTemporalDeadZone, QV4::Compiler::Codegen::Reference::storeConsumeAccumulator(), QV4::CallData::This, ThisFunctionName, usesArgumentsObject, and usesThis.
Referenced by QV4::Compiler::ControlFlowBlock::ControlFlowBlock(), QV4::Compiler::ControlFlowCatch::~ControlFlowCatch(), and QV4::Compiler::Codegen::defineFunction().
|
inline |
Definition at line 278 of file qv4compilercontext_p.h.
References arg, arguments, QList< T >::at(), i, and QList< T >::size().
Definition at line 291 of file qv4compilercontext_p.h.
References QMap< Key, T >::end(), QMap< Key, T >::find(), it, members, parent, and Q_ASSERT.
|
inline |
Definition at line 273 of file qv4compilercontext_p.h.
References arguments, and QQmlJS::AST::BoundNames::contains().
|
inline |
Definition at line 364 of file qv4compilercontext_p.h.
References QV4::Compiler::Block, and contextType.
Definition at line 300 of file qv4compilercontext_p.h.
References QMap< Key, T >::end(), QMap< Key, T >::find(), it, members, and Q_ASSERT.
|
inline |
Definition at line 312 of file qv4compilercontext_p.h.
References QV4::Compiler::Binding, contextType, QV4::Compiler::Eval, QV4::Compiler::Global, and QV4::Compiler::ScriptImportedByQML.
Referenced by QV4::Compiler::Codegen::defineFunction().
Context::ResolvedName Context::resolveName | ( | const QString & | name, |
const QQmlJS::SourceLocation & | accessLocation | ||
) |
Definition at line 94 of file qv4compilercontext.cpp.
References QV4::Compiler::Binding, QV4::Compiler::Block, QV4::Compiler::ESModule, QV4::Compiler::Eval, QV4::Compiler::Context::ResolvedName::Global, i, QV4::Compiler::Context::ResolvedName::Import, QV4::Compiler::Context::ResolvedName::Local, Q_ASSERT, QV4::Compiler::Context::ResolvedName::QmlGlobal, QV4::Compiler::ScriptImportedByQML, QV4::Compiler::Context::ResolvedName::Stack, QV4::Compiler::Context::Member::type, and UndefinedMember.
Referenced by QV4::Compiler::Codegen::referenceForName().
void Context::setupFunctionIndices | ( | Moth::BytecodeGenerator * | bytecodeGenerator | ) |
Definition at line 303 of file qv4compilercontext.cpp.
References QMap< Key, T >::begin(), QV4::Compiler::Binding, QV4::Compiler::Block, QMap< Key, T >::contains(), contextType, QV4::Moth::BytecodeGenerator::currentRegister(), QMap< Key, T >::end(), QV4::Compiler::ESModule, QV4::Compiler::Eval, firstTemporalDeadZoneRegister, QV4::CallData::Function, QV4::Compiler::Function, QV4::Compiler::Global, QString::isEmpty(), isStrict, it, localNameForDefaultExport, locals, members, QV4::Moth::BytecodeGenerator::newRegister(), QV4::Moth::BytecodeGenerator::newRegisterArray(), nRegisters, Q_ASSERT, registerOffset, QV4::Compiler::ScriptImportedByQML, QList< T >::size(), sizeOfLocalTemporalDeadZone, sizeOfRegisterTemporalDeadZone, and ThisFunctionName.
Referenced by emitBlockHeader().
bool QV4::Compiler::Context::allVarsEscape = false |
Definition at line 197 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::ScanFunctions::calcEscapingVariables().
QQmlJS::AST::BoundNames QV4::Compiler::Context::arguments |
Definition at line 176 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), findArgument(), hasArgument(), and QV4::Compiler::JSUnitGenerator::writeFunction().
|
mutable |
Definition at line 206 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction().
int QV4::Compiler::Context::blockIndex = -1 |
Definition at line 139 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), emitBlockHeader(), and QV4::Compiler::JSUnitGenerator::writeBlock().
QString QV4::Compiler::Context::caughtVariable |
Definition at line 210 of file qv4compilercontext_p.h.
Referenced by addLocalVar(), emitBlockHeader(), and QV4::Compiler::ScanFunctions::visit().
QByteArray QV4::Compiler::Context::code |
Definition at line 186 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), and QV4::Compiler::JSUnitGenerator::writeFunction().
int QV4::Compiler::Context::column = 0 |
Definition at line 136 of file qv4compilercontext_p.h.
Referenced by QQmlJSCodeGenerator::run(), and QV4::Compiler::JSUnitGenerator::writeFunction().
ContextType QV4::Compiler::Context::contextType |
Definition at line 221 of file qv4compilercontext_p.h.
Referenced by addLocalVar(), QV4::Compiler::ScanFunctions::calcEscapingVariables(), canHaveTailCalls(), QV4::Compiler::Codegen::defineFunction(), emitBlockFooter(), emitBlockHeader(), isCaseBlock(), requiresImplicitReturnValue(), setupFunctionIndices(), QV4::Compiler::Codegen::visit(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().
ControlFlow* QV4::Compiler::Context::controlFlow = nullptr |
Definition at line 185 of file qv4compilercontext_p.h.
QVector<ExportEntry> QV4::Compiler::Context::exportEntries |
Definition at line 181 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::generateFromModule(), and QV4::Compiler::ScanFunctions::visit().
int QV4::Compiler::Context::firstTemporalDeadZoneRegister = 0 |
Definition at line 194 of file qv4compilercontext_p.h.
Referenced by setupFunctionIndices(), and QV4::Compiler::JSUnitGenerator::writeFunction().
QQmlJS::AST::FormalParameterList* QV4::Compiler::Context::formals = nullptr |
Definition at line 175 of file qv4compilercontext_p.h.
Referenced by addLocalVar(), emitBlockHeader(), and QV4::Compiler::JSUnitGenerator::writeFunction().
int QV4::Compiler::Context::functionIndex = -1 |
Definition at line 138 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), and QV4::Compiler::Codegen::leaveContext().
bool QV4::Compiler::Context::hasDirectEval = false |
Definition at line 196 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::ScanFunctions::visit().
bool QV4::Compiler::Context::hasNestedFunctions = false |
Definition at line 198 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::ScanFunctions::visit(), and QV4::Compiler::ScanFunctions::visit().
QVector<ImportEntry> QV4::Compiler::Context::importEntries |
Definition at line 180 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::generateFromModule(), and QV4::Compiler::ScanFunctions::visit().
bool QV4::Compiler::Context::innerFunctionAccessesNewTarget = false |
Definition at line 204 of file qv4compilercontext_p.h.
Referenced by emitBlockHeader(), and QV4::Compiler::JSUnitGenerator::writeFunction().
bool QV4::Compiler::Context::innerFunctionAccessesThis = false |
Definition at line 203 of file qv4compilercontext_p.h.
Referenced by emitBlockHeader(), and QV4::Compiler::JSUnitGenerator::writeFunction().
bool QV4::Compiler::Context::isArrowFunction = false |
bool QV4::Compiler::Context::isCatchBlock = false |
Definition at line 209 of file qv4compilercontext_p.h.
Referenced by addLocalVar(), emitBlockHeader(), and QV4::Compiler::ScanFunctions::visit().
bool QV4::Compiler::Context::isGenerator = false |
Definition at line 201 of file qv4compilercontext_p.h.
Referenced by canHaveTailCalls(), QV4::Compiler::Codegen::defineFunction(), and QV4::Compiler::JSUnitGenerator::writeFunction().
bool QV4::Compiler::Context::isStrict = false |
Definition at line 199 of file qv4compilercontext_p.h.
Referenced by Context(), canHaveTailCalls(), QV4::Compiler::ScanFunctions::checkDirectivePrologue(), QV4::Compiler::ScanFunctions::checkName(), QV4::Compiler::Codegen::defineFunction(), emitBlockHeader(), QV4::Compiler::ScanFunctions::enterEnvironment(), QV4::Compiler::ScanFunctions::enterFunction(), setupFunctionIndices(), QV4::Compiler::Codegen::throwSyntaxErrorOnEvalOrArgumentsInStrictMode(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::Codegen::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), and QV4::Compiler::JSUnitGenerator::writeFunction().
bool QV4::Compiler::Context::isWithBlock = false |
Definition at line 208 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::ScanFunctions::calcEscapingVariables(), and QV4::Compiler::ScanFunctions::visit().
std::vector<unsigned> QV4::Compiler::Context::labelInfo |
Definition at line 189 of file qv4compilercontext_p.h.
Referenced by QQmlJSCodeGenerator::run(), and QV4::Compiler::JSUnitGenerator::writeFunction().
QQmlJS::SourceLocation QV4::Compiler::Context::lastBlockInitializerLocation |
Definition at line 211 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::ScanFunctions::visit(), and QV4::Compiler::ScanFunctions::visit().
int QV4::Compiler::Context::line = 0 |
Definition at line 135 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), QQmlJSCodeGenerator::run(), and QV4::Compiler::JSUnitGenerator::writeFunction().
QVector<CompiledData::CodeOffsetToLineAndStatement> QV4::Compiler::Context::lineAndStatementNumberMapping |
Definition at line 187 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), and QV4::Compiler::JSUnitGenerator::writeFunction().
QString QV4::Compiler::Context::localNameForDefaultExport |
Definition at line 182 of file qv4compilercontext_p.h.
Referenced by setupFunctionIndices(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::ScanFunctions::visit().
QStringList QV4::Compiler::Context::locals |
Definition at line 178 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), setupFunctionIndices(), QV4::Compiler::Codegen::visit(), QV4::Compiler::JSUnitGenerator::writeBlock(), and QV4::Compiler::JSUnitGenerator::writeFunction().
MemberMap QV4::Compiler::Context::members |
Definition at line 173 of file qv4compilercontext_p.h.
Referenced by addLocalVar(), emitBlockHeader(), findMember(), memberInfo(), and setupFunctionIndices().
QStringList QV4::Compiler::Context::moduleRequests |
Definition at line 179 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::generateFromModule(), QV4::Compiler::ScanFunctions::visit(), and QV4::Compiler::ScanFunctions::visit().
QString QV4::Compiler::Context::name |
Definition at line 134 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), QQmlJSCodeGenerator::run(), and QV4::Compiler::JSUnitGenerator::writeFunction().
Definition at line 183 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::JSUnitGenerator::writeFunction().
int QV4::Compiler::Context::nRegisters = 0 |
Definition at line 191 of file qv4compilercontext_p.h.
Referenced by emitBlockHeader(), and setupFunctionIndices().
Context* QV4::Compiler::Context::parent |
Definition at line 133 of file qv4compilercontext_p.h.
Referenced by Context(), addLocalVar(), QV4::Compiler::ScanFunctions::calcEscapingVariables(), canHaveTailCalls(), QV4::Compiler::Codegen::defineFunction(), findMember(), QV4::Compiler::Codegen::leaveContext(), QV4::Compiler::Codegen::visit(), and QV4::Compiler::Codegen::visit().
int QV4::Compiler::Context::registerCountInFunction = 0 |
Definition at line 137 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), and QV4::Compiler::JSUnitGenerator::writeFunction().
int QV4::Compiler::Context::registerOffset = -1 |
Definition at line 192 of file qv4compilercontext_p.h.
Referenced by emitBlockHeader(), and setupFunctionIndices().
bool QV4::Compiler::Context::requiresExecutionContext = false |
Definition at line 207 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::ControlFlowBlock::ControlFlowBlock(), QV4::Compiler::ControlFlowBlock::~ControlFlowBlock(), QV4::Compiler::Codegen::defineFunction(), emitBlockFooter(), emitBlockHeader(), endsWithReturn(), QV4::Compiler::ControlFlowBlock::requiresUnwind(), and QV4::Compiler::Codegen::visit().
bool QV4::Compiler::Context::returnsClosure = false |
Definition at line 205 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::Codegen::defineFunction(), and QV4::Compiler::JSUnitGenerator::writeFunction().
QQmlJS::AST::Type* QV4::Compiler::Context::returnType = nullptr |
Definition at line 177 of file qv4compilercontext_p.h.
Referenced by QV4::Compiler::JSUnitGenerator::writeFunction().
int QV4::Compiler::Context::sizeOfLocalTemporalDeadZone = 0 |
Definition at line 193 of file qv4compilercontext_p.h.
Referenced by setupFunctionIndices(), QV4::Compiler::JSUnitGenerator::writeBlock(), and QV4::Compiler::JSUnitGenerator::writeFunction().
int QV4::Compiler::Context::sizeOfRegisterTemporalDeadZone = 0 |
Definition at line 195 of file qv4compilercontext_p.h.
Referenced by emitBlockHeader(), setupFunctionIndices(), and QV4::Compiler::JSUnitGenerator::writeFunction().
std::unique_ptr<SourceLocationTable> QV4::Compiler::Context::sourceLocationTable |
Definition at line 188 of file qv4compilercontext_p.h.
Definition at line 174 of file qv4compilercontext_p.h.
Referenced by addUsedVariable().
UsesArgumentsObject QV4::Compiler::Context::usesArgumentsObject = ArgumentsObjectUnknown |
Definition at line 219 of file qv4compilercontext_p.h.
Referenced by emitBlockHeader(), QV4::Compiler::ScanFunctions::visit(), QV4::Compiler::ScanFunctions::visit(), and QV4::Compiler::ScanFunctions::visit().
bool QV4::Compiler::Context::usesThis = false |
Definition at line 202 of file qv4compilercontext_p.h.
Referenced by emitBlockHeader(), and QV4::Compiler::ScanFunctions::visit().