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
QmlIR::JSCodeGen Struct Reference

#include <qqmlirbuilder_p.h>

+ Inheritance diagram for QmlIR::JSCodeGen:
+ Collaboration diagram for QmlIR::JSCodeGen:

Public Member Functions

 JSCodeGen (Document *document, const QSet< QString > &globalNames, QV4::Compiler::CodegenWarningInterface *iface=QV4::Compiler::defaultCodegenWarningInterface(), bool storeSourceLocations=false)
 
QVector< int > generateJSCodeForFunctionsAndBindings (const QList< CompiledFunctionOrExpression > &functions)
 
bool generateRuntimeFunctions (QmlIR::Object *object)
 
- Public Member Functions inherited from QV4::Compiler::Codegen
 Codegen (QV4::Compiler::JSUnitGenerator *jsUnitGenerator, bool strict, CodegenWarningInterface *iface=defaultCodegenWarningInterface(), bool storeSourceLocations=false)
 
void generateFromProgram (const QString &fileName, const QString &finalUrl, const QString &sourceCode, QQmlJS::AST::Program *ast, Module *module, ContextType contextType=ContextType::Global)
 
void generateFromModule (const QString &fileName, const QString &finalUrl, const QString &sourceCode, QQmlJS::AST::ESModule *ast, Module *module)
 
ContextenterBlock (QQmlJS::AST::Node *node)
 
int leaveBlock ()
 
int registerString (const QString &name)
 
int registerConstant (QV4::ReturnedValue v)
 
int registerGetterLookup (int nameIndex, JSUnitGenerator::LookupMode mode)
 
int registerSetterLookup (int nameIndex)
 
int registerGlobalGetterLookup (int nameIndex, JSUnitGenerator::LookupMode mode)
 
int registerQmlContextPropertyGetterLookup (int nameIndex, JSUnitGenerator::LookupMode mode)
 
virtual int defineFunction (const QString &name, QQmlJS::AST::Node *ast, QQmlJS::AST::FormalParameterList *formals, QQmlJS::AST::StatementList *body)
 
ErrorType errorType () const
 
bool hasError () const
 
QQmlJS::DiagnosticMessage error () const
 
QUrl url () const
 
Reference binopHelper (QQmlJS::AST::BinaryExpression *ast, QSOperator::Op oper, Reference &left, Reference &right)
 
Reference jumpBinop (QSOperator::Op oper, Reference &left, Reference &right)
 
Arguments pushArgs (QQmlJS::AST::ArgumentList *args)
 
void handleCall (Reference &base, Arguments calldata, int slotForFunction, int slotForThisObject, bool optional=false)
 
Arguments pushTemplateArgs (QQmlJS::AST::TemplateLiteral *args)
 
bool handleTaggedTemplate (Reference base, QQmlJS::AST::TaggedTemplate *ast)
 
void createTemplateObject (QQmlJS::AST::TemplateLiteral *t)
 
void setUseFastLookups (bool b)
 
void handleTryCatch (QQmlJS::AST::TryStatement *ast)
 
void handleTryFinally (QQmlJS::AST::TryStatement *ast)
 
Reference referenceForName (const QString &name, bool lhs, const QQmlJS::SourceLocation &accessLocation=QQmlJS::SourceLocation())
 
QQmlRefPointer< QV4::CompiledData::CompilationUnitgenerateCompilationUnit (bool generateUnitData=true)
 
ContextcurrentContext () const
 
BytecodeGeneratorgenerator () const
 
void loadClosure (int index)
 
Modulemodule () const
 
BytecodeGenerator::Label returnLabel ()
 
void setGlobalNames (const QSet< QString > &globalNames)
 

Additional Inherited Members

- Public Types inherited from QV4::Compiler::Codegen
enum  ErrorType { NoError , SyntaxError , ReferenceError }
 
- Static Public Member Functions inherited from QV4::Compiler::Codegen
static QQmlRefPointer< QV4::CompiledData::CompilationUnitcompileModule (bool debugMode, const QString &url, const QString &sourceCode, const QDateTime &sourceTimeStamp, QList< QQmlJS::DiagnosticMessage > *diagnostics)
 
- Static Public Attributes inherited from QV4::Compiler::Codegen
static const char * s_globalNames []
 
- Protected Types inherited from QV4::Compiler::Codegen
enum  Format { ex , cx , nx }
 
enum  UnaryOperation {
  UPlus , UMinus , PreIncrement , PreDecrement ,
  PostIncrement , PostDecrement , Not , Compl
}
 
using BytecodeGenerator = QV4::Moth::BytecodeGenerator
 
using Instruction = QV4::Moth::Instruction
 
- Protected Member Functions inherited from QV4::Compiler::Codegen
void enterContext (QQmlJS::AST::Node *node)
 
int leaveContext ()
 
void leaveLoop ()
 
Reference unop (UnaryOperation op, const Reference &expr)
 
void addCJump ()
 
void statement (QQmlJS::AST::Statement *ast)
 
void statement (QQmlJS::AST::ExpressionNode *ast)
 
void condition (QQmlJS::AST::ExpressionNode *ast, const BytecodeGenerator::Label *iftrue, const BytecodeGenerator::Label *iffalse, bool trueBlockFollowsCondition)
 
Reference expression (QQmlJS::AST::ExpressionNode *ast, const QString &name=QString())
 
void accept (QQmlJS::AST::Node *node)
 
void program (QQmlJS::AST::Program *ast)
 
void statementList (QQmlJS::AST::StatementList *ast)
 
void variableDeclaration (QQmlJS::AST::PatternElement *ast)
 
void variableDeclarationList (QQmlJS::AST::VariableDeclarationList *ast)
 
Reference targetForPatternElement (QQmlJS::AST::PatternElement *p)
 
void initializeAndDestructureBindingElement (QQmlJS::AST::PatternElement *e, const Reference &baseRef=Reference(), bool isDefinition=false)
 
void destructurePropertyList (const Reference &object, QQmlJS::AST::PatternPropertyList *bindingList, bool isDefinition=false)
 
void destructureElementList (const Reference &array, QQmlJS::AST::PatternElementList *bindingList, bool isDefinition=false)
 
void destructurePattern (QQmlJS::AST::Pattern *p, const Reference &rhs)
 
Reference referenceForPropertyName (const Codegen::Reference &object, QQmlJS::AST::PropertyName *name)
 
void emitReturn (const Reference &expr)
 
bool visit (QQmlJS::AST::ArgumentList *ast) override
 
bool visit (QQmlJS::AST::CaseBlock *ast) override
 
bool visit (QQmlJS::AST::CaseClause *ast) override
 
bool visit (QQmlJS::AST::CaseClauses *ast) override
 
bool visit (QQmlJS::AST::Catch *ast) override
 
bool visit (QQmlJS::AST::DefaultClause *ast) override
 
bool visit (QQmlJS::AST::Elision *ast) override
 
bool visit (QQmlJS::AST::Finally *ast) override
 
bool visit (QQmlJS::AST::FormalParameterList *ast) override
 
bool visit (QQmlJS::AST::Program *ast) override
 
bool visit (QQmlJS::AST::StatementList *ast) override
 
bool visit (QQmlJS::AST::UiArrayMemberList *ast) override
 
bool visit (QQmlJS::AST::UiImport *ast) override
 
bool visit (QQmlJS::AST::UiHeaderItemList *ast) override
 
bool visit (QQmlJS::AST::UiPragmaValueList *ast) override
 
bool visit (QQmlJS::AST::UiPragma *ast) override
 
bool visit (QQmlJS::AST::UiObjectInitializer *ast) override
 
bool visit (QQmlJS::AST::UiObjectMemberList *ast) override
 
bool visit (QQmlJS::AST::UiParameterList *ast) override
 
bool visit (QQmlJS::AST::UiProgram *ast) override
 
bool visit (QQmlJS::AST::UiQualifiedId *ast) override
 
bool visit (QQmlJS::AST::VariableDeclarationList *ast) override
 
bool visit (QQmlJS::AST::PatternElement *ast) override
 
bool visit (QQmlJS::AST::PatternElementList *ast) override
 
bool visit (QQmlJS::AST::PatternProperty *ast) override
 
bool visit (QQmlJS::AST::PatternPropertyList *ast) override
 
bool visit (QQmlJS::AST::ExportDeclaration *ast) override
 
bool visit (QQmlJS::AST::TypeAnnotation *ast) override
 
bool visit (QQmlJS::AST::Expression *ast) override
 
bool visit (QQmlJS::AST::ArrayPattern *ast) override
 
bool visit (QQmlJS::AST::ArrayMemberExpression *ast) override
 
bool visit (QQmlJS::AST::BinaryExpression *ast) override
 
bool visit (QQmlJS::AST::CallExpression *ast) override
 
void endVisit (QQmlJS::AST::CallExpression *ast) override
 
bool visit (QQmlJS::AST::ConditionalExpression *ast) override
 
bool visit (QQmlJS::AST::DeleteExpression *ast) override
 
void endVisit (QQmlJS::AST::DeleteExpression *ast) override
 
bool visit (QQmlJS::AST::FalseLiteral *ast) override
 
bool visit (QQmlJS::AST::SuperLiteral *ast) override
 
bool visit (QQmlJS::AST::FieldMemberExpression *ast) override
 
void endVisit (QQmlJS::AST::FieldMemberExpression *ast) override
 
bool visit (QQmlJS::AST::TaggedTemplate *ast) override
 
bool visit (QQmlJS::AST::FunctionExpression *ast) override
 
bool visit (QQmlJS::AST::IdentifierExpression *ast) override
 
bool visit (QQmlJS::AST::NestedExpression *ast) override
 
bool visit (QQmlJS::AST::NewExpression *ast) override
 
bool visit (QQmlJS::AST::NewMemberExpression *ast) override
 
bool visit (QQmlJS::AST::NotExpression *ast) override
 
bool visit (QQmlJS::AST::NullExpression *ast) override
 
bool visit (QQmlJS::AST::NumericLiteral *ast) override
 
bool visit (QQmlJS::AST::ObjectPattern *ast) override
 
bool visit (QQmlJS::AST::PostDecrementExpression *ast) override
 
bool visit (QQmlJS::AST::PostIncrementExpression *ast) override
 
bool visit (QQmlJS::AST::PreDecrementExpression *ast) override
 
bool visit (QQmlJS::AST::PreIncrementExpression *ast) override
 
bool visit (QQmlJS::AST::RegExpLiteral *ast) override
 
bool visit (QQmlJS::AST::StringLiteral *ast) override
 
bool visit (QQmlJS::AST::TemplateLiteral *ast) override
 
bool visit (QQmlJS::AST::ThisExpression *ast) override
 
bool visit (QQmlJS::AST::TildeExpression *ast) override
 
bool visit (QQmlJS::AST::TrueLiteral *ast) override
 
bool visit (QQmlJS::AST::TypeOfExpression *ast) override
 
bool visit (QQmlJS::AST::UnaryMinusExpression *ast) override
 
bool visit (QQmlJS::AST::UnaryPlusExpression *ast) override
 
bool visit (QQmlJS::AST::VoidExpression *ast) override
 
bool visit (QQmlJS::AST::FunctionDeclaration *ast) override
 
bool visit (QQmlJS::AST::YieldExpression *ast) override
 
bool visit (QQmlJS::AST::ClassExpression *ast) override
 
bool visit (QQmlJS::AST::ClassDeclaration *ast) override
 
bool visit (QQmlJS::AST::Block *ast) override
 
bool visit (QQmlJS::AST::BreakStatement *ast) override
 
bool visit (QQmlJS::AST::ContinueStatement *ast) override
 
bool visit (QQmlJS::AST::DebuggerStatement *ast) override
 
bool visit (QQmlJS::AST::DoWhileStatement *ast) override
 
bool visit (QQmlJS::AST::EmptyStatement *ast) override
 
bool visit (QQmlJS::AST::ExpressionStatement *ast) override
 
bool visit (QQmlJS::AST::ForEachStatement *ast) override
 
bool visit (QQmlJS::AST::ForStatement *ast) override
 
bool visit (QQmlJS::AST::IfStatement *ast) override
 
bool visit (QQmlJS::AST::LabelledStatement *ast) override
 
bool visit (QQmlJS::AST::ReturnStatement *ast) override
 
bool visit (QQmlJS::AST::SwitchStatement *ast) override
 
bool visit (QQmlJS::AST::ThrowStatement *ast) override
 
bool visit (QQmlJS::AST::TryStatement *ast) override
 
bool visit (QQmlJS::AST::VariableStatement *ast) override
 
bool visit (QQmlJS::AST::WhileStatement *ast) override
 
bool visit (QQmlJS::AST::WithStatement *ast) override
 
bool visit (QQmlJS::AST::UiArrayBinding *ast) override
 
bool visit (QQmlJS::AST::UiObjectBinding *ast) override
 
bool visit (QQmlJS::AST::UiObjectDefinition *ast) override
 
bool visit (QQmlJS::AST::UiPublicMember *ast) override
 
bool visit (QQmlJS::AST::UiScriptBinding *ast) override
 
bool visit (QQmlJS::AST::UiSourceElement *ast) override
 
bool throwSyntaxErrorOnEvalOrArgumentsInStrictMode (const Reference &r, const QQmlJS::SourceLocation &loc)
 
virtual void throwSyntaxError (const QQmlJS::SourceLocation &loc, const QString &detail)
 
virtual void throwReferenceError (const QQmlJS::SourceLocation &loc, const QString &detail)
 
void throwRecursionDepthError () override
 
void setExprResult (const Reference &result)
 
void setExprResult (Reference &&result)
 
Reference exprResult () const
 
void clearExprResultName ()
 
bool exprAccept (Format f)
 
const ResultcurrentExpr () const
 
void pushExpr (Result &&expr)
 
void pushExpr (const Result &expr)
 
void pushExpr (const QString &name=QString())
 
Result popExpr ()
 
Reference popResult ()
 
- Protected Member Functions inherited from QQmlJS::AST::Visitor
 Visitor (quint16 parentRecursionDepth=0)
 
bool preVisit (Node *) override
 
void postVisit (Node *) override
 
- Protected Member Functions inherited from QQmlJS::AST::BaseVisitor
 BaseVisitor (quint16 parentRecursionDepth=0)
 
virtual ~BaseVisitor ()
 
quint16 recursionDepth () const
 
- Protected Attributes inherited from QV4::Compiler::Codegen
std::vector< Resultm_expressions
 
VolatileMemoryLocations _volatileMemoryLocations
 
Module_module
 
int _returnAddress
 
Context_context
 
Context_functionContext = nullptr
 
QQmlJS::AST::LabelledStatement_labelledStatement
 
QV4::Compiler::JSUnitGeneratorjsUnitGenerator
 
BytecodeGeneratorbytecodeGenerator = nullptr
 
Moth::BytecodeGenerator::Label_returnLabel = nullptr
 
bool _strictMode
 
bool useFastLookups = true
 
bool requiresReturnValue = false
 
bool insideSwitch = false
 
bool inFormalParameterList = false
 
bool functionEndsWithReturn = false
 
bool _tailCallsAreAllowed = true
 
bool storeSourceLocations = false
 
QSet< QStringm_globalNames
 
QSet< QQmlJS::AST::Node * > m_seenOptionalChainNodes
 
std::stack< OptionalChainStatem_optionalChainsStates
 
ControlFlowcontrolFlow = nullptr
 
bool _fileNameIsUrl
 
ErrorType _errorType = NoError
 
QQmlJS::DiagnosticMessage _error
 
CodegenWarningInterface_interface
 
- Protected Attributes inherited from QQmlJS::AST::BaseVisitor
quint16 m_recursionDepth = 0
 

Detailed Description

Definition at line 632 of file qqmlirbuilder_p.h.

Constructor & Destructor Documentation

◆ JSCodeGen()

JSCodeGen::JSCodeGen ( Document * document,
const QSet< QString > & globalNames,
QV4::Compiler::CodegenWarningInterface * iface = QV4::Compiler::defaultCodegenWarningInterface(),
bool storeSourceLocations = false )

Member Function Documentation

◆ generateJSCodeForFunctionsAndBindings()

◆ generateRuntimeFunctions()

bool JSCodeGen::generateRuntimeFunctions ( QmlIR::Object * object)

Definition at line 2070 of file qqmlirbuilder.cpp.

References generateJSCodeForFunctionsAndBindings(), QV4::Compiler::Codegen::hasError(), QmlIR::Document::jsParserEngine, and QQmlJS::Engine::pool().

+ Here is the call graph for this function:

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