![]() |
Qt 6.x
The Qt SDK
|
#include <qv4compilerscanfunctions_p.h>
Public Member Functions | |
ScanFunctions (Codegen *cg, const QString &sourceCode, ContextType defaultProgramType) | |
void | operator() (QQmlJS::AST::Node *node) |
void | handleTopLevelFunctionFormals (QQmlJS::AST::FunctionExpression *node) |
void | enterGlobalEnvironment (ContextType compilationMode) |
void | enterEnvironment (QQmlJS::AST::Node *node, ContextType compilationMode, const QString &name) |
void | leaveEnvironment () |
void | enterQmlFunction (QQmlJS::AST::FunctionExpression *ast) |
Protected Types | |
enum class | FunctionNameContext { None , Inner , Outer } |
Protected Attributes | |
Codegen * | _cg |
const QString | _sourceCode |
Context * | _context |
QStack< Context * > | _contextStack |
bool | _allowFuncDecls |
ContextType | defaultProgramType |
![]() | |
quint16 | m_recursionDepth = 0 |
Definition at line 43 of file qv4compilerscanfunctions_p.h.
|
strongprotected |
Enumerator | |
---|---|
None | |
Inner | |
Outer |
Definition at line 72 of file qv4compilerscanfunctions_p.h.
ScanFunctions::ScanFunctions | ( | Codegen * | cg, |
const QString & | sourceCode, | ||
ContextType | defaultProgramType | ||
) |
Definition at line 28 of file qv4compilerscanfunctions.cpp.
|
protected |
Definition at line 721 of file qv4compilerscanfunctions.cpp.
References _cg, QV4::Compiler::Codegen::_module, QV4::Compiler::Context::allVarsEscape, arguments, QV4::Compiler::Context::ArgumentsObjectNotUsed, QV4::Compiler::Context::ArgumentsObjectUnknown, QV4::Compiler::Context::ArgumentsObjectUsed, QV4::Compiler::Binding, QV4::Compiler::Block, QSet< T >::constBegin(), QSet< T >::constEnd(), QSet< T >::constFind(), QV4::Compiler::Context::contextType, QV4::Compiler::ESModule, QV4::Compiler::Eval, QV4::Compiler::Global, QV4::Compiler::Context::isArrowFunction, QV4::Compiler::Context::isWithBlock, it, QV4::Compiler::Context::parent, Q_ASSERT, qDebug, qEnvironmentVariableIsSet(), QStringLiteral, QV4::Compiler::ScriptImportedByQML, QLatin1StringView::size(), var, QV4::Compiler::Context::VariableDeclaration, and QV4::Compiler::Context::VariableDefinition.
Referenced by operator()().
|
protected |
Definition at line 69 of file qv4compilerscanfunctions.cpp.
References _context, _sourceCode, QV4::Compiler::Context::isStrict, it, QString::mid(), Q_ASSERT, and str.
Referenced by visit().
|
protected |
Definition at line 94 of file qv4compilerscanfunctions.cpp.
References _cg, _context, QV4::Compiler::Context::isStrict, Q_ASSERT, QStringLiteral, and QV4::Compiler::Codegen::throwSyntaxError().
Referenced by visit(), and visit().
|
overrideprotected |
Definition at line 577 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 588 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 616 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 401 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 382 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 132 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 557 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 536 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 509 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 474 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 497 of file qv4compilerscanfunctions.cpp.
|
overrideprotected |
Definition at line 119 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
|
overrideprotected |
Definition at line 639 of file qv4compilerscanfunctions.cpp.
References leaveEnvironment().
void ScanFunctions::enterEnvironment | ( | QQmlJS::AST::Node * | node, |
ContextType | compilationMode, | ||
const QString & | name | ||
) |
Definition at line 51 of file qv4compilerscanfunctions.cpp.
References _cg, _context, _contextStack, QV4::Compiler::Codegen::_module, QV4::Compiler::Codegen::_strictMode, QV4::Compiler::Module::contextMap, QV4::Compiler::Context::isStrict, and QV4::Compiler::Module::newContext().
Referenced by enterGlobalEnvironment(), QV4::RuntimeCodegen::generateFromFunctionExpression(), QmlIR::JSCodeGen::generateJSCodeForFunctionsAndBindings(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
protected |
Definition at line 466 of file qv4compilerscanfunctions.cpp.
References _cg, _context, QQmlJS::AST::FunctionExpression::body, enterFunction(), QQmlJS::AST::FunctionExpression::formals, QQmlJS::AST::FunctionExpression::identifierToken, QV4::Compiler::Context::isStrict, QQmlJS::AST::FunctionExpression::name, Q_ASSERT, QStringLiteral, QV4::Compiler::Codegen::throwSyntaxError(), and QStringView::toString().
Referenced by enterFunction(), enterQmlFunction(), visit(), visit(), and visit().
|
protected |
void ScanFunctions::enterGlobalEnvironment | ( | ContextType | compilationMode | ) |
Definition at line 46 of file qv4compilerscanfunctions.cpp.
References enterEnvironment(), and QStringLiteral.
Referenced by QmlIR::JSCodeGen::generateJSCodeForFunctionsAndBindings().
|
inline |
Definition at line 62 of file qv4compilerscanfunctions_p.h.
References enterFunction(), and None.
Referenced by QmlIR::JSCodeGen::generateJSCodeForFunctionsAndBindings().
|
inline |
Definition at line 52 of file qv4compilerscanfunctions_p.h.
References QQmlJS::AST::Node::accept(), and QQmlJS::AST::FunctionExpression::formals.
Referenced by QmlIR::JSCodeGen::generateJSCodeForFunctionsAndBindings().
void ScanFunctions::leaveEnvironment | ( | ) |
Definition at line 63 of file qv4compilerscanfunctions.cpp.
References _context, _contextStack, and nullptr.
Referenced by endVisit(), endVisit(), endVisit(), endVisit(), endVisit(), endVisit(), endVisit(), endVisit(), endVisit(), endVisit(), endVisit(), endVisit(), QV4::RuntimeCodegen::generateFromFunctionExpression(), QmlIR::JSCodeGen::generateJSCodeForFunctionsAndBindings(), and visit().
void ScanFunctions::operator() | ( | QQmlJS::AST::Node * | node | ) |
Definition at line 38 of file qv4compilerscanfunctions.cpp.
References calcEscapingVariables().
|
overrideprotectedvirtual |
Implements QQmlJS::AST::BaseVisitor.
Definition at line 892 of file qv4compilerscanfunctions.cpp.
References _cg, and QV4::Compiler::Codegen::throwRecursionDepthError().
|
overrideprotected |
Definition at line 458 of file qv4compilerscanfunctions.cpp.
References QQmlJS::AST::ArrayPattern::elements, and it.
|
overrideprotected |
Definition at line 569 of file qv4compilerscanfunctions.cpp.
References _allowFuncDecls, _context, QV4::Compiler::Block, enterEnvironment(), QV4::Compiler::Context::isStrict, QStringLiteral, and QQmlJS::AST::Block::statements.
|
overrideprotected |
Definition at line 279 of file qv4compilerscanfunctions.cpp.
References _context, QV4::Compiler::Context::ArgumentsObjectUnknown, QV4::Compiler::Context::ArgumentsObjectUsed, QQmlJS::AST::CallExpression::base, QV4::Compiler::Context::hasDirectEval, Q_ASSERT, and QV4::Compiler::Context::usesArgumentsObject.
|
overrideprotected |
Definition at line 582 of file qv4compilerscanfunctions.cpp.
References QV4::Compiler::Block, enterEnvironment(), and QStringLiteral.
|
overrideprotected |
Definition at line 593 of file qv4compilerscanfunctions.cpp.
References _allowFuncDecls, _cg, _context, QV4::Compiler::Context::addLocalVar(), QQmlJS::AST::PatternElement::bindingIdentifier, QV4::Compiler::Block, QV4::Compiler::Context::caughtVariable, enterEnvironment(), QQmlJS::AST::Catch::identifierToken, QV4::Compiler::Context::isCatchBlock, QString::isEmpty(), QV4::Compiler::Context::isStrict, QQmlJS::AST::Catch::patternElement, Q_ASSERT, QStringLiteral, QQmlJS::AST::Catch::statement, QQmlJS::AST::Block::statements, QV4::Compiler::Codegen::throwSyntaxError(), QStringView::toString(), and QV4::Compiler::Context::VariableDefinition.
|
overrideprotected |
Definition at line 387 of file qv4compilerscanfunctions.cpp.
References _context, QV4::Compiler::Context::addLocalVar(), QV4::Compiler::Block, enterEnvironment(), QV4::Compiler::Context::hasNestedFunctions, QStringView::isEmpty(), QV4::Compiler::Context::isStrict, QQmlJS::AST::ClassExpression::name, Q_ASSERT, QStringLiteral, QStringView::toString(), QV4::Compiler::Context::VariableDeclaration, and QV4::Compiler::Context::VariableDefinition.
|
overrideprotected |
Definition at line 371 of file qv4compilerscanfunctions.cpp.
References _context, QV4::Compiler::Context::addLocalVar(), QV4::Compiler::Block, enterEnvironment(), QV4::Compiler::Context::hasNestedFunctions, QStringView::isEmpty(), QV4::Compiler::Context::isStrict, QQmlJS::AST::ClassExpression::name, Q_ASSERT, QStringLiteral, QStringView::toString(), and QV4::Compiler::Context::VariableDefinition.
|
overrideprotected |
Definition at line 514 of file qv4compilerscanfunctions.cpp.
References _allowFuncDecls, _context, QQmlJS::AST::DoWhileStatement::expression, QV4::Compiler::Context::isStrict, and QQmlJS::AST::DoWhileStatement::statement.
|
overrideprotected |
Definition at line 124 of file qv4compilerscanfunctions.cpp.
References _context, defaultProgramType, enterEnvironment(), QV4::Compiler::Context::isStrict, Q_ASSERT, and QStringLiteral.
|
overrideprotected |
Definition at line 137 of file qv4compilerscanfunctions.cpp.
References _context, QQmlJS::AST::Node::asFunctionDefinition(), QQmlJS::AST::ExportDeclaration::exportClause, QQmlJS::AST::ExportDeclaration::exportDefault, QQmlJS::AST::ExportSpecifier::exportedIdentifier, QV4::Compiler::Context::exportEntries, QQmlJS::AST::ExportDeclaration::exportsAll(), QQmlJS::AST::ExportClause::exportsList, QQmlJS::AST::ExportDeclaration::firstSourceLocation(), QQmlJS::AST::ExportDeclaration::fromClause, QQmlJS::AST::ExportSpecifier::identifier, QString::isEmpty(), it, QV4::Compiler::Context::localNameForDefaultExport, QV4::Compiler::Context::moduleRequests, QQmlJS::AST::FromClause::moduleSpecifier, Q_ASSERT, Q_ASSERT_X, QStringLiteral, QStringView::toString(), and QQmlJS::AST::ExportDeclaration::variableStatementOrDeclaration.
|
overrideprotected |
Definition at line 340 of file qv4compilerscanfunctions.cpp.
References _allowFuncDecls, _cg, _sourceCode, enterFunction(), QQmlJS::AST::ExpressionStatement::expression, QQmlJS::AST::ExpressionStatement::firstSourceLocation(), Inner, leaveEnvironment(), QQmlJS::SourceLocation::length, QString::mid(), None, QQmlJS::SourceLocation::offset, QStringLiteral, and QV4::Compiler::Codegen::throwSyntaxError().
|
overrideprotected |
Definition at line 432 of file qv4compilerscanfunctions.cpp.
References _cg, _context, QQmlJS::AST::FieldMemberExpression::base, QV4::Compiler::Block, QQmlJS::AST::FieldMemberExpression::identifierToken, QV4::Compiler::Context::isArrowFunction, QQmlJS::AST::FieldMemberExpression::name, Q_ASSERT, and QV4::Compiler::Codegen::throwSyntaxError().
|
overrideprotected |
Definition at line 541 of file qv4compilerscanfunctions.cpp.
References _allowFuncDecls, _context, QV4::Compiler::Block, enterEnvironment(), QQmlJS::AST::ForEachStatement::expression, QV4::Compiler::Context::isStrict, QV4::Compiler::Context::lastBlockInitializerLocation, QQmlJS::AST::Node::lastSourceLocation(), QQmlJS::AST::ForEachStatement::lhs, Q_ASSERT, QStringLiteral, and QQmlJS::AST::ForEachStatement::statement.
|
overrideprotected |
Definition at line 523 of file qv4compilerscanfunctions.cpp.
References _allowFuncDecls, _context, QV4::Compiler::Block, QQmlJS::AST::ForStatement::condition, QQmlJS::AST::ForStatement::declarations, enterEnvironment(), QQmlJS::AST::ForStatement::expression, QQmlJS::AST::ForStatement::initialiser, QV4::Compiler::Context::isStrict, QStringLiteral, and QQmlJS::AST::ForStatement::statement.
|
overrideprotected |
Definition at line 504 of file qv4compilerscanfunctions.cpp.
References enterFunction(), and Outer.
|
overrideprotected |
Definition at line 364 of file qv4compilerscanfunctions.cpp.
References enterFunction(), QQmlJS::AST::FunctionExpression::identifierToken, Inner, QQmlJS::SourceLocation::length, and None.
|
overrideprotected |
Definition at line 330 of file qv4compilerscanfunctions.cpp.
References _context, QV4::Compiler::Context::addUsedVariable(), QV4::Compiler::Context::ArgumentsObjectUnknown, QV4::Compiler::Context::ArgumentsObjectUsed, checkName(), QQmlJS::AST::IdentifierExpression::identifierToken, QQmlJS::AST::IdentifierExpression::name, Q_ASSERT, QStringView::toString(), and QV4::Compiler::Context::usesArgumentsObject.
|
overrideprotected |
Definition at line 230 of file qv4compilerscanfunctions.cpp.
References _context, QQmlJS::AST::ImportDeclaration::firstSourceLocation(), QQmlJS::AST::ImportDeclaration::fromClause, QQmlJS::AST::ImportDeclaration::importClause, QV4::Compiler::Context::importEntries, QString::isEmpty(), QSet< T >::isEmpty(), QStringView::isEmpty(), it, QV4::Compiler::Context::moduleRequests, QQmlJS::AST::FromClause::moduleSpecifier, QQmlJS::AST::ImportDeclaration::moduleSpecifier, Q_ASSERT, QStringLiteral, and QStringView::toString().
|
overrideprotected |
Definition at line 479 of file qv4compilerscanfunctions.cpp.
References _allowFuncDecls, and QQmlJS::AST::ObjectPattern::properties.
|
overrideprotected |
Definition at line 294 of file qv4compilerscanfunctions.cpp.
References _cg, _context, QV4::Compiler::Context::addLocalVar(), QV4::Compiler::Context::ArgumentsObjectNotUsed, QQmlJS::AST::PatternElement::boundNames(), checkName(), QQmlJS::AST::PatternElement::destructuringPattern(), QQmlJS::SourceLocation::end(), QQmlJS::AST::PatternElement::firstSourceLocation(), QQmlJS::AST::PatternElement::identifierToken, QQmlJS::AST::PatternElement::initializer, QQmlJS::AST::PatternElement::isForDeclaration, QV4::Compiler::Context::isStrict, QQmlJS::SourceLocation::isValid(), QQmlJS::AST::PatternElement::isVariableDeclaration(), QV4::Compiler::Context::lastBlockInitializerLocation, QQmlJS::AST::PatternElement::lastSourceLocation(), QQmlJS::SourceLocation::length, QQmlJS::SourceLocation::offset, Q_ASSERT, QStringLiteral, QQmlJS::AST::PatternElement::scope, QV4::Compiler::Codegen::throwSyntaxError(), QV4::Compiler::Context::usesArgumentsObject, QV4::Compiler::Context::VariableDeclaration, and QV4::Compiler::Context::VariableDefinition.
|
overrideprotected |
Definition at line 486 of file qv4compilerscanfunctions.cpp.
References Q_UNUSED.
|
overrideprotected |
Definition at line 112 of file qv4compilerscanfunctions.cpp.
References checkDirectivePrologue(), defaultProgramType, enterEnvironment(), QStringLiteral, and QQmlJS::AST::Program::statements.
|
overrideprotected |
Definition at line 417 of file qv4compilerscanfunctions.cpp.
References _context, QV4::Compiler::Block, QV4::Compiler::Context::isArrowFunction, and Q_ASSERT.
|
overrideprotected |
Definition at line 406 of file qv4compilerscanfunctions.cpp.
References QQmlJS::AST::TemplateLiteral::expression, and QQmlJS::AST::TemplateLiteral::next.
|
overrideprotected |
Definition at line 562 of file qv4compilerscanfunctions.cpp.
References _context, Q_ASSERT, and QV4::Compiler::Context::usesThis.
|
overrideprotected |
Definition at line 621 of file qv4compilerscanfunctions.cpp.
References _allowFuncDecls, _cg, _context, QV4::Compiler::Block, enterEnvironment(), QQmlJS::AST::WithStatement::expression, QV4::Compiler::Context::isStrict, QV4::Compiler::Context::isWithBlock, Q_ASSERT, QStringLiteral, QQmlJS::AST::WithStatement::statement, QV4::Compiler::Codegen::throwSyntaxError(), and QQmlJS::AST::WithStatement::withToken.
|
protected |
|
protected |
Definition at line 150 of file qv4compilerscanfunctions_p.h.
Referenced by calcEscapingVariables(), checkName(), enterEnvironment(), enterFunction(), throwRecursionDepthError(), visit(), visit(), visit(), visit(), and visit().
|
protected |
Definition at line 152 of file qv4compilerscanfunctions_p.h.
Referenced by checkDirectivePrologue(), checkName(), enterEnvironment(), enterFunction(), leaveEnvironment(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
Definition at line 153 of file qv4compilerscanfunctions_p.h.
Referenced by enterEnvironment(), and leaveEnvironment().
|
protected |
Definition at line 151 of file qv4compilerscanfunctions_p.h.
Referenced by checkDirectivePrologue(), and visit().
|
protected |
Definition at line 156 of file qv4compilerscanfunctions_p.h.