diff options
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator_p.h')
-rw-r--r-- | src/qml/compiler/qqmlcodegenerator_p.h | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h index a5fec65111..0a0e4f2d5b 100644 --- a/src/qml/compiler/qqmlcodegenerator_p.h +++ b/src/qml/compiler/qqmlcodegenerator_p.h @@ -166,6 +166,20 @@ struct Pragma QV4::CompiledData::Location location; }; +struct CompiledFunctionOrExpression +{ + CompiledFunctionOrExpression() + : disableAcceleratedLookups(false) + {} + CompiledFunctionOrExpression(AST::Node *n) + : node(n) + , disableAcceleratedLookups(false) + {} + AST::Node *node; // FunctionDeclaration, Statement or Expression + QString name; + bool disableAcceleratedLookups; +}; + struct ParsedQML { ParsedQML(bool debugMode) @@ -180,7 +194,7 @@ struct ParsedQML AST::UiProgram *program; int indexOfRootObject; QList<QmlObject*> objects; - QList<AST::Node*> functions; // FunctionDeclaration, Statement or Expression + QList<CompiledFunctionOrExpression> functions; QV4::Compiler::JSUnitGenerator jsGenerator; QV4::CompiledData::TypeReferenceMap typeReferences; @@ -269,7 +283,7 @@ public: QList<QV4::CompiledData::Import*> _imports; QList<Pragma*> _pragmas; QList<QmlObject*> _objects; - QList<AST::Node*> _functions; + QList<CompiledFunctionOrExpression> _functions; QV4::CompiledData::TypeReferenceMap _typeReferences; @@ -347,7 +361,7 @@ private: struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen { - JSCodeGen(QQmlEnginePrivate *enginePrivate, const QString &fileName, const QString &sourceCode, V4IR::Module *jsModule, + JSCodeGen(const QString &fileName, const QString &sourceCode, V4IR::Module *jsModule, QQmlJS::Engine *jsEngine, AST::UiProgram *qmlRoot, QQmlTypeNameCache *imports); struct IdMapping @@ -362,26 +376,28 @@ struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen void beginObjectScope(QQmlPropertyCache *scopeObject); // Returns mapping from input functions to index in V4IR::Module::functions / compiledData->runtimeFunctions - QVector<int> generateJSCodeForFunctionsAndBindings(const QList<AST::Node*> &functions, const QHash<int, QString> &functionNames); - - // Resolve QObject members with the help of QQmlEngine's meta type registry - virtual V4IR::Expr *member(V4IR::Expr *base, const QString *name); + QVector<int> generateJSCodeForFunctionsAndBindings(const QList<CompiledFunctionOrExpression> &functions); protected: + virtual void beginFunctionBodyHook(); virtual V4IR::Expr *fallbackNameLookup(const QString &name, int line, int col); private: QQmlPropertyData *lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name, bool *propertyExistsButForceNameLookup = 0); - QQmlEnginePrivate *engine; QString sourceCode; QQmlJS::Engine *jsEngine; // needed for memory pool AST::UiProgram *qmlRoot; QQmlTypeNameCache *imports; + bool _disableAcceleratedLookups; ObjectIdMapping _idObjects; QQmlPropertyCache *_contextObject; QQmlPropertyCache *_scopeObject; + int _contextObjectTemp; + int _scopeObjectTemp; + int _importedScriptsTemp; + int _idArrayTemp; }; } // namespace QtQml |