aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlcompiler_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/qml/qqmlcompiler_p.h')
-rw-r--r--src/qml/qml/qqmlcompiler_p.h50
1 files changed, 28 insertions, 22 deletions
diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h
index 516f6653ca..2ce850da5d 100644
--- a/src/qml/qml/qqmlcompiler_p.h
+++ b/src/qml/qml/qqmlcompiler_p.h
@@ -65,6 +65,7 @@
#include <private/qqmlcodegenerator_p.h>
#include "private/qv4identifier_p.h"
#include <private/qqmljsastfwd_p.h>
+#include "qqmlcustomparser_p.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qset.h>
@@ -84,6 +85,7 @@ class QQmlComponent;
class QQmlContext;
class QQmlContextData;
+// ### Merge with QV4::CompiledData::CompilationUnit
class Q_AUTOTEST_EXPORT QQmlCompiledData : public QQmlRefCount, public QQmlCleanup
{
public:
@@ -100,7 +102,7 @@ public:
int listMetaTypeId;
bool isRegisteredWithEngine;
- struct TypeReference
+ struct TypeReference
{
TypeReference()
: type(0), typePropertyCache(0), component(0)
@@ -128,7 +130,7 @@ public:
QList<TypeReference> types;
// --- new compiler:
// map from name index
- QHash<int, TypeReference> resolvedTypes;
+ QHash<int, TypeReference*> resolvedTypes;
// ---
struct V8Program {
@@ -144,9 +146,9 @@ public:
QQmlPropertyCache *rootPropertyCache;
QList<QString> primitives;
- QList<QByteArray> datas;
+ QVector<QByteArray> datas;
QByteArray bytecode;
- QList<QQmlPropertyCache *> propertyCaches;
+ QVector<QQmlPropertyCache *> propertyCaches;
QList<QVector<QQmlContextData::ObjectIdMapping> > contextCaches;
QList<QQmlScriptData *> scripts;
QList<QUrl> urls;
@@ -157,7 +159,11 @@ public:
// index in first hash is component index, hash inside maps from object index in that scope to integer id
QHash<int, QHash<int, int> > objectIndexToIdPerComponent;
QHash<int, int> objectIndexToIdForRoot;
+ // hash key is object index
+ QHash<int, QByteArray> customParserData;
QVector<int> customParserBindings; // index is binding identifier, value is compiled function index.
+ int totalBindingsCount; // Number of bindings used in this type
+ int totalParserStatusCount; // Number of instantiated types that are QQmlParserStatus subclasses
bool isComponent(int objectIndex) const { return objectIndexToIdPerComponent.contains(objectIndex); }
bool isCompositeType() const { return !datas.at(qmlUnit->indexOfRootObject).isEmpty(); }
@@ -205,7 +211,7 @@ private:
};
namespace QQmlCompilerTypes {
- struct BindingContext
+ struct BindingContext
{
BindingContext()
: stack(0), owner(0), object(0) {}
@@ -255,7 +261,7 @@ namespace QQmlCompilerTypes {
int n;
};
- struct IdList : public QFieldList<QQmlScript::Object,
+ struct IdList : public QFieldList<QQmlScript::Object,
&QQmlScript::Object::nextIdObject>
{
QQmlScript::Object *value(const QString &id) const {
@@ -289,8 +295,8 @@ namespace QQmlCompilerTypes {
// more than one of these for each compile
struct ComponentCompileState : public QQmlPool::Class
{
- ComponentCompileState()
- : parserStatusCount(0), totalBindingsCount(0), pushedProperties(0), nested(false),
+ ComponentCompileState()
+ : parserStatusCount(0), totalBindingsCount(0), pushedProperties(0), nested(false),
root(0) {}
IdList ids;
@@ -330,7 +336,7 @@ namespace QQmlCompilerTypes {
};
class QMetaObjectBuilder;
-class Q_AUTOTEST_EXPORT QQmlCompiler
+class Q_AUTOTEST_EXPORT QQmlCompiler : public QQmlCustomParserCompilerBackend
{
Q_DECLARE_TR_FUNCTIONS(QQmlCompiler)
public:
@@ -346,9 +352,9 @@ public:
static bool isAttachedPropertyName(const QHashedStringRef &);
static bool isSignalPropertyName(const QHashedStringRef &);
- int evaluateEnum(const QHashedStringRef &scope, const QByteArray& enumValue, bool *ok) const; // for QQmlCustomParser::evaluateEnum
- const QMetaObject *resolveType(const QString& name) const; // for QQmlCustomParser::resolveType
- int bindingIdentifier(const QString &name, const QQmlScript::Variant& value, const QQmlCompilerTypes::BindingContext &ctxt); // for QQmlCustomParser::bindingIndex
+ virtual QQmlBinding::Identifier bindingIdentifier(const QQmlScript::Variant&value, const QString&name, QQmlCustomParser *customParser);
+
+ virtual const QQmlImports &imports() const { return unit->imports(); }
private:
typedef QQmlCompiledData::Instruction Instruction;
@@ -361,23 +367,23 @@ private:
bool buildObject(QQmlScript::Object *obj, const QQmlCompilerTypes::BindingContext &);
bool buildComponent(QQmlScript::Object *obj, const QQmlCompilerTypes::BindingContext &);
bool buildSubObject(QQmlScript::Object *obj, const QQmlCompilerTypes::BindingContext &);
- bool buildSignal(QQmlScript::Property *prop, QQmlScript::Object *obj,
+ bool buildSignal(QQmlScript::Property *prop, QQmlScript::Object *obj,
const QQmlCompilerTypes::BindingContext &);
- bool buildProperty(QQmlScript::Property *prop, QQmlScript::Object *obj,
+ bool buildProperty(QQmlScript::Property *prop, QQmlScript::Object *obj,
const QQmlCompilerTypes::BindingContext &);
bool buildPropertyInNamespace(QQmlImportNamespace *ns,
- QQmlScript::Property *prop,
- QQmlScript::Object *obj,
+ QQmlScript::Property *prop,
+ QQmlScript::Object *obj,
const QQmlCompilerTypes::BindingContext &);
bool buildIdProperty(QQmlScript::Property *prop, QQmlScript::Object *obj);
- bool buildAttachedProperty(QQmlScript::Property *prop,
+ bool buildAttachedProperty(QQmlScript::Property *prop,
QQmlScript::Object *obj,
const QQmlCompilerTypes::BindingContext &ctxt);
bool buildGroupedProperty(QQmlScript::Property *prop,
QQmlScript::Object *obj,
const QQmlCompilerTypes::BindingContext &ctxt);
- bool buildValueTypeProperty(QObject *type,
- QQmlScript::Object *obj,
+ bool buildValueTypeProperty(QObject *type,
+ QQmlScript::Object *obj,
QQmlScript::Object *baseObj,
const QQmlCompilerTypes::BindingContext &ctxt);
bool buildListProperty(QQmlScript::Property *prop,
@@ -429,13 +435,13 @@ private:
void genComponent(QQmlScript::Object *obj);
void genValueProperty(QQmlScript::Property *prop, QQmlScript::Object *obj);
void genListProperty(QQmlScript::Property *prop, QQmlScript::Object *obj);
- void genPropertyAssignment(QQmlScript::Property *prop,
+ void genPropertyAssignment(QQmlScript::Property *prop,
QQmlScript::Object *obj,
QQmlScript::Property *valueTypeProperty = 0);
void genLiteralAssignment(QQmlScript::Property *prop,
QQmlScript::Value *value);
- void genBindingAssignment(QQmlScript::Value *binding,
- QQmlScript::Property *prop,
+ void genBindingAssignment(QQmlScript::Value *binding,
+ QQmlScript::Property *prop,
QQmlScript::Object *obj,
QQmlScript::Property *valueTypeProperty = 0);
int genContextCache();