aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-03-17 17:11:20 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-17 20:41:34 +0100
commitecd4a9ba23c0c538e73dc4f9e75c4d5361ba4c0e (patch)
tree4dce15579db4ced8b1e390c8c24af66850227fab
parent05a12c9ebe558303fb1eb92a272e66fa1313b854 (diff)
Namespace cleanup
Move the QML IR types into the QmlIR namespace and clean them up. Change-Id: I2125449e5a519034e23670651efa620f405730b4 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp153
-rw-r--r--src/qml/compiler/qqmlcodegenerator_p.h67
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp212
-rw-r--r--src/qml/compiler/qqmltypecompiler_p.h48
-rw-r--r--src/qml/qml/qqmlbinding.cpp2
-rw-r--r--src/qml/qml/qqmlcustomparser.cpp2
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp2
-rw-r--r--src/qml/qml/qqmltypeloader.cpp8
-rw-r--r--src/qml/qml/qqmltypeloader_p.h4
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp2
10 files changed, 234 insertions, 266 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 45373c6d11..c826049ef7 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -58,7 +58,7 @@ static const quint32 emptyStringIndex = 0;
DEFINE_BOOL_CONFIG_OPTION(lookupHints, QML_LOOKUP_HINTS);
-using namespace QtQml;
+using namespace QmlIR;
#define COMPILE_EXCEPTION(location, desc) \
{ \
@@ -66,7 +66,7 @@ using namespace QtQml;
return false; \
}
-void QmlObject::init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const QQmlJS::AST::SourceLocation &loc)
+void Object::init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const QQmlJS::AST::SourceLocation &loc)
{
inheritedTypeNameIndex = typeNameIndex;
@@ -75,7 +75,7 @@ void QmlObject::init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const
idIndex = id;
indexOfDefaultProperty = -1;
- properties = pool->New<PoolList<QmlProperty> >();
+ properties = pool->New<PoolList<Property> >();
qmlSignals = pool->New<PoolList<Signal> >();
bindings = pool->New<PoolList<Binding> >();
functions = pool->New<PoolList<Function> >();
@@ -84,16 +84,7 @@ void QmlObject::init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const
declarationsOverride = 0;
}
-void QmlObject::dump(DebugStream &out)
-{
- out << inheritedTypeNameIndex << " {" << endl;
- out.indent++;
-
- out.indent--;
- out << "}" << endl;
-}
-
-QString QmlObject::sanityCheckFunctionNames(const QSet<QString> &illegalNames, QQmlJS::AST::SourceLocation *errorLocation)
+QString Object::sanityCheckFunctionNames(const QSet<QString> &illegalNames, QQmlJS::AST::SourceLocation *errorLocation)
{
QSet<int> functionNames;
for (Function *f = functions->first; f; f = f->next) {
@@ -104,7 +95,7 @@ QString QmlObject::sanityCheckFunctionNames(const QSet<QString> &illegalNames, Q
return tr("Duplicate method name");
functionNames.insert(f->nameIndex);
- for (QtQml::Signal *s = qmlSignals->first; s; s = s->next) {
+ for (QmlIR::Signal *s = qmlSignals->first; s; s = s->next) {
if (s->nameIndex == f->nameIndex)
return tr("Duplicate method name");
}
@@ -118,9 +109,9 @@ QString QmlObject::sanityCheckFunctionNames(const QSet<QString> &illegalNames, Q
return QString(); // no error
}
-QString QmlObject::appendSignal(Signal *signal)
+QString Object::appendSignal(Signal *signal)
{
- QmlObject *target = declarationsOverride;
+ Object *target = declarationsOverride;
if (!target)
target = this;
@@ -133,13 +124,13 @@ QString QmlObject::appendSignal(Signal *signal)
return QString(); // no error
}
-QString QmlObject::appendProperty(QmlProperty *prop, const QString &propertyName, bool isDefaultProperty, const QQmlJS::AST::SourceLocation &defaultToken, QQmlJS::AST::SourceLocation *errorLocation)
+QString Object::appendProperty(Property *prop, const QString &propertyName, bool isDefaultProperty, const QQmlJS::AST::SourceLocation &defaultToken, QQmlJS::AST::SourceLocation *errorLocation)
{
- QmlObject *target = declarationsOverride;
+ Object *target = declarationsOverride;
if (!target)
target = this;
- for (QmlProperty *p = target->properties->first; p; p = p->next)
+ for (Property *p = target->properties->first; p; p = p->next)
if (p->nameIndex == prop->nameIndex)
return tr("Duplicate property name");
@@ -157,15 +148,15 @@ QString QmlObject::appendProperty(QmlProperty *prop, const QString &propertyName
return QString(); // no error
}
-void QmlObject::appendFunction(QtQml::Function *f)
+void Object::appendFunction(QmlIR::Function *f)
{
- QmlObject *target = declarationsOverride;
+ Object *target = declarationsOverride;
if (!target)
target = this;
target->functions->append(f);
}
-QString QmlObject::appendBinding(Binding *b, bool isListBinding)
+QString Object::appendBinding(Binding *b, bool isListBinding)
{
const bool bindingToDefaultProperty = (b->propertyNameIndex == 0);
if (!isListBinding && !bindingToDefaultProperty
@@ -183,7 +174,7 @@ QString QmlObject::appendBinding(Binding *b, bool isListBinding)
return QString(); // no error
}
-Binding *QmlObject::findBinding(quint32 nameIndex) const
+Binding *Object::findBinding(quint32 nameIndex) const
{
for (Binding *b = bindings->first; b; b = b->next)
if (b->propertyNameIndex == nameIndex)
@@ -191,7 +182,7 @@ Binding *QmlObject::findBinding(quint32 nameIndex) const
return 0;
}
-void QmlObject::insertSorted(Binding *b)
+void Object::insertSorted(Binding *b)
{
Binding *insertionPoint = bindings->findSortedInsertionPoint<QV4::CompiledData::Location, QV4::CompiledData::Binding, &QV4::CompiledData::Binding::valueLocation>(b);
bindings->insertAfter(insertionPoint, b);
@@ -349,7 +340,7 @@ bool QQmlCodeGenerator::visit(QQmlJS::AST::UiScriptBinding *node)
bool QQmlCodeGenerator::visit(QQmlJS::AST::UiArrayBinding *node)
{
const QQmlJS::AST::SourceLocation qualifiedNameLocation = node->qualifiedId->identifierToken;
- QmlObject *object = 0;
+ Object *object = 0;
QQmlJS::AST::UiQualifiedId *name = node->qualifiedId;
if (!resolveQualifiedId(&name, &object))
return false;
@@ -413,7 +404,7 @@ void QQmlCodeGenerator::accept(QQmlJS::AST::Node *node)
QQmlJS::AST::Node::acceptChild(node, this);
}
-bool QQmlCodeGenerator::defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, QmlObject *declarationsOverride)
+bool QQmlCodeGenerator::defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, Object *declarationsOverride)
{
if (QQmlJS::AST::UiQualifiedId *lastName = qualifiedTypeNameId) {
while (lastName->next)
@@ -424,7 +415,7 @@ bool QQmlCodeGenerator::defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifi
}
}
- QmlObject *obj = New<QmlObject>();
+ Object *obj = New<Object>();
_objects.append(obj);
*objectIndex = _objects.size() - 1;
qSwap(_object, obj);
@@ -433,7 +424,7 @@ bool QQmlCodeGenerator::defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifi
_object->declarationsOverride = declarationsOverride;
// A new object is also a boundary for property declarations.
- QmlProperty *declaration = 0;
+ Property *declaration = 0;
qSwap(_propertyDeclaration, declaration);
accept(initializer);
@@ -720,7 +711,7 @@ bool QQmlCodeGenerator::visit(QQmlJS::AST::UiPublicMember *node)
return false;
}
- QmlProperty *property = New<QmlProperty>();
+ Property *property = New<Property>();
property->flags = 0;
if (node->isReadonlyMember)
property->flags |= QV4::CompiledData::Property::IsReadOnly;
@@ -933,7 +924,7 @@ void QQmlCodeGenerator::setBindingValue(QV4::CompiledData::Binding *binding, QQm
void QQmlCodeGenerator::appendBinding(QQmlJS::AST::UiQualifiedId *name, QQmlJS::AST::Statement *value)
{
const QQmlJS::AST::SourceLocation qualifiedNameLocation = name->identifierToken;
- QmlObject *object = 0;
+ Object *object = 0;
if (!resolveQualifiedId(&name, &object))
return;
qSwap(_object, object);
@@ -944,7 +935,7 @@ void QQmlCodeGenerator::appendBinding(QQmlJS::AST::UiQualifiedId *name, QQmlJS::
void QQmlCodeGenerator::appendBinding(QQmlJS::AST::UiQualifiedId *name, int objectIndex, bool isOnAssignment)
{
const QQmlJS::AST::SourceLocation qualifiedNameLocation = name->identifierToken;
- QmlObject *object = 0;
+ Object *object = 0;
if (!resolveQualifiedId(&name, &object, isOnAssignment))
return;
qSwap(_object, object);
@@ -983,7 +974,7 @@ void QQmlCodeGenerator::appendBinding(const QQmlJS::AST::SourceLocation &qualifi
binding->location.line = nameLocation.startLine;
binding->location.column = nameLocation.startColumn;
- const QmlObject *obj = _objects.at(objectIndex);
+ const Object *obj = _objects.at(objectIndex);
binding->valueLocation = obj->location;
binding->flags = 0;
@@ -1009,7 +1000,7 @@ void QQmlCodeGenerator::appendBinding(const QQmlJS::AST::SourceLocation &qualifi
}
}
-QmlObject *QQmlCodeGenerator::bindingsTarget() const
+Object *QQmlCodeGenerator::bindingsTarget() const
{
if (_propertyDeclaration && _object->declarationsOverride)
return _object->declarationsOverride;
@@ -1064,7 +1055,7 @@ bool QQmlCodeGenerator::setId(const QQmlJS::AST::SourceLocation &idLocation, QQm
return true;
}
-bool QQmlCodeGenerator::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, QmlObject **object, bool onAssignment)
+bool QQmlCodeGenerator::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, Object **object, bool onAssignment)
{
QQmlJS::AST::UiQualifiedId *qualifiedIdElement = *nameToResolve;
@@ -1155,14 +1146,14 @@ void QQmlCodeGenerator::recordError(const QQmlJS::AST::SourceLocation &location,
void QQmlCodeGenerator::collectTypeReferences()
{
- foreach (QmlObject *obj, _objects) {
+ foreach (Object *obj, _objects) {
if (obj->inheritedTypeNameIndex != emptyStringIndex) {
QV4::CompiledData::TypeReference &r = _typeReferences.add(obj->inheritedTypeNameIndex, obj->location);
r.needsCreation = true;
r.errorWhenNotFound = true;
}
- for (const QmlProperty *prop = obj->firstProperty(); prop; prop = prop->next) {
+ for (const Property *prop = obj->firstProperty(); prop; prop = prop->next) {
if (prop->type >= QV4::CompiledData::Property::Custom) {
// ### FIXME: We could report the more accurate location here by using prop->location, but the old
// compiler can't and the tests expect it to be the object location right now.
@@ -1225,10 +1216,10 @@ QV4::CompiledData::QmlUnit *QmlUnitGenerator::generate(ParsedQML &output)
const int importSize = sizeof(QV4::CompiledData::Import) * output.imports.count();
const int objectOffsetTableSize = output.objects.count() * sizeof(quint32);
- QHash<QmlObject*, quint32> objectOffsets;
+ QHash<Object*, quint32> objectOffsets;
int objectsSize = 0;
- foreach (QmlObject *o, output.objects) {
+ foreach (Object *o, output.objects) {
objectOffsets.insert(o, unitSize + importSize + objectOffsetTableSize + objectsSize);
objectsSize += QV4::CompiledData::Object::calculateSizeExcludingSignals(o->functionCount(), o->propertyCount(), o->signalCount(), o->bindingCount());
@@ -1264,7 +1255,7 @@ QV4::CompiledData::QmlUnit *QmlUnitGenerator::generate(ParsedQML &output)
// write objects
quint32 *objectTable = reinterpret_cast<quint32*>(data + qmlUnit->offsetToObjects);
char *objectPtr = data + qmlUnit->offsetToObjects + objectOffsetTableSize;
- foreach (QmlObject *o, output.objects) {
+ foreach (Object *o, output.objects) {
*objectTable++ = objectOffsets.value(o);
QV4::CompiledData::Object *objectToWrite = reinterpret_cast<QV4::CompiledData::Object*>(objectPtr);
@@ -1297,7 +1288,7 @@ QV4::CompiledData::QmlUnit *QmlUnitGenerator::generate(ParsedQML &output)
*functionsTable++ = o->runtimeFunctionIndices->at(f->index);
char *propertiesPtr = objectPtr + objectToWrite->offsetToProperties;
- for (const QmlProperty *p = o->firstProperty(); p; p = p->next) {
+ for (const Property *p = o->firstProperty(); p; p = p->next) {
QV4::CompiledData::Property *propertyToWrite = reinterpret_cast<QV4::CompiledData::Property*>(propertiesPtr);
*propertyToWrite = *p;
propertiesPtr += sizeof(QV4::CompiledData::Property);
@@ -1346,7 +1337,7 @@ QV4::CompiledData::QmlUnit *QmlUnitGenerator::generate(ParsedQML &output)
return qmlUnit;
}
-char *QmlUnitGenerator::writeBindings(char *bindingPtr, QmlObject *o, BindingFilter filter) const
+char *QmlUnitGenerator::writeBindings(char *bindingPtr, Object *o, BindingFilter filter) const
{
for (const Binding *b = o->firstBinding(); b; b = b->next) {
if (!(b->*(filter))())
@@ -1365,7 +1356,7 @@ int QmlUnitGenerator::getStringId(const QString &str) const
return jsUnitGenerator->getStringId(str);
}
-JSCodeGen::JSCodeGen(const QString &fileName, const QString &sourceCode, IR::Module *jsModule, QQmlJS::Engine *jsEngine,
+JSCodeGen::JSCodeGen(const QString &fileName, const QString &sourceCode, QV4::IR::Module *jsModule, QQmlJS::Engine *jsEngine,
QQmlJS::AST::UiProgram *qmlRoot, QQmlTypeNameCache *imports, const QStringList &stringPool)
: QQmlJS::Codegen(/*strict mode*/false)
, sourceCode(sourceCode)
@@ -1494,7 +1485,7 @@ QQmlPropertyData *JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache
return pd;
}
-static void initMetaObjectResolver(IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject);
+static void initMetaObjectResolver(QV4::IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject);
enum MetaObjectResolverFlags {
AllPropertiesAreFinal = 0x1,
@@ -1503,11 +1494,11 @@ enum MetaObjectResolverFlags {
ResolveTypeInformationOnly = 0x8
};
-static void initMetaObjectResolver(IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject);
+static void initMetaObjectResolver(QV4::IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject);
-static IR::Type resolveQmlType(QQmlEnginePrivate *qmlEngine, IR::MemberExpressionResolver *resolver, IR::Member *member)
+static QV4::IR::Type resolveQmlType(QQmlEnginePrivate *qmlEngine, QV4::IR::MemberExpressionResolver *resolver, QV4::IR::Member *member)
{
- IR::Type result = IR::VarType;
+ QV4::IR::Type result = QV4::IR::VarType;
QQmlType *type = static_cast<QQmlType*>(resolver->data);
@@ -1517,7 +1508,7 @@ static IR::Type resolveQmlType(QQmlEnginePrivate *qmlEngine, IR::MemberExpressio
if (ok) {
member->setEnumValue(value);
resolver->clear();
- return IR::SInt32Type;
+ return QV4::IR::SInt32Type;
}
}
@@ -1540,7 +1531,7 @@ static IR::Type resolveQmlType(QQmlEnginePrivate *qmlEngine, IR::MemberExpressio
return result;
}
-static void initQmlTypeResolver(IR::MemberExpressionResolver *resolver, QQmlType *qmlType)
+static void initQmlTypeResolver(QV4::IR::MemberExpressionResolver *resolver, QQmlType *qmlType)
{
resolver->resolveMember = &resolveQmlType;
resolver->data = qmlType;
@@ -1548,9 +1539,9 @@ static void initQmlTypeResolver(IR::MemberExpressionResolver *resolver, QQmlType
resolver->flags = 0;
}
-static IR::Type resolveImportNamespace(QQmlEnginePrivate *, IR::MemberExpressionResolver *resolver, IR::Member *member)
+static QV4::IR::Type resolveImportNamespace(QQmlEnginePrivate *, QV4::IR::MemberExpressionResolver *resolver, QV4::IR::Member *member)
{
- IR::Type result = IR::VarType;
+ QV4::IR::Type result = QV4::IR::VarType;
QQmlTypeNameCache *typeNamespace = static_cast<QQmlTypeNameCache*>(resolver->extraData);
void *importNamespace = resolver->data;
@@ -1559,14 +1550,14 @@ static IR::Type resolveImportNamespace(QQmlEnginePrivate *, IR::MemberExpression
member->freeOfSideEffects = true;
if (r.scriptIndex != -1) {
// TODO: remember the index and replace with subscript later.
- result = IR::VarType;
+ result = QV4::IR::VarType;
} else if (r.type) {
// TODO: Propagate singleton information, so that it is loaded
// through the singleton getter in the run-time. Until then we
// can't accelerate access :(
if (!r.type->isSingleton()) {
initQmlTypeResolver(resolver, r.type);
- return IR::QObjectType;
+ return QV4::IR::QObjectType;
}
} else {
Q_ASSERT(false); // How can this happen?
@@ -1577,7 +1568,7 @@ static IR::Type resolveImportNamespace(QQmlEnginePrivate *, IR::MemberExpression
return result;
}
-static void initImportNamespaceResolver(IR::MemberExpressionResolver *resolver, QQmlTypeNameCache *imports, const void *importNamespace)
+static void initImportNamespaceResolver(QV4::IR::MemberExpressionResolver *resolver, QQmlTypeNameCache *imports, const void *importNamespace)
{
resolver->resolveMember = &resolveImportNamespace;
resolver->data = const_cast<void*>(importNamespace);
@@ -1585,9 +1576,9 @@ static void initImportNamespaceResolver(IR::MemberExpressionResolver *resolver,
resolver->flags = 0;
}
-static IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, IR::MemberExpressionResolver *resolver, IR::Member *member)
+static QV4::IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, QV4::IR::MemberExpressionResolver *resolver, QV4::IR::Member *member)
{
- IR::Type result = IR::VarType;
+ QV4::IR::Type result = QV4::IR::VarType;
QQmlPropertyCache *metaObject = static_cast<QQmlPropertyCache*>(resolver->data);
if (member->name->constData()->isUpper() && (resolver->flags & LookupsIncludeEnums)) {
@@ -1600,7 +1591,7 @@ static IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, IR::Memb
if (ok) {
member->setEnumValue(value);
resolver->clear();
- return IR::SInt32Type;
+ return QV4::IR::SInt32Type;
}
}
}
@@ -1633,24 +1624,24 @@ static IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, IR::Memb
// Enums cannot be mapped to IR types, they need to go through the run-time handling
// of accepting strings that will then be converted to the right values.
if (property->isEnum())
- return IR::VarType;
+ return QV4::IR::VarType;
switch (property->propType) {
- case QMetaType::Bool: result = IR::BoolType; break;
- case QMetaType::Int: result = IR::SInt32Type; break;
- case QMetaType::Double: result = IR::DoubleType; break;
- case QMetaType::QString: result = IR::StringType; break;
+ case QMetaType::Bool: result = QV4::IR::BoolType; break;
+ case QMetaType::Int: result = QV4::IR::SInt32Type; break;
+ case QMetaType::Double: result = QV4::IR::DoubleType; break;
+ case QMetaType::QString: result = QV4::IR::StringType; break;
default:
if (property->isQObject()) {
if (QQmlPropertyCache *cache = qmlEngine->propertyCacheForType(property->propType)) {
initMetaObjectResolver(resolver, cache);
- return IR::QObjectType;
+ return QV4::IR::QObjectType;
}
} else if (QQmlValueType *valueType = QQmlValueTypeFactory::valueType(property->propType)) {
if (QQmlPropertyCache *cache = qmlEngine->cache(valueType->metaObject())) {
initMetaObjectResolver(resolver, cache);
resolver->flags |= ResolveTypeInformationOnly;
- return IR::QObjectType;
+ return QV4::IR::QObjectType;
}
}
break;
@@ -1661,7 +1652,7 @@ static IR::Type resolveMetaObjectProperty(QQmlEnginePrivate *qmlEngine, IR::Memb
return result;
}
-static void initMetaObjectResolver(IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject)
+static void initMetaObjectResolver(QV4::IR::MemberExpressionResolver *resolver, QQmlPropertyCache *metaObject)
{
resolver->resolveMember = &resolveMetaObjectProperty;
resolver->data = metaObject;
@@ -1676,19 +1667,19 @@ void JSCodeGen::beginFunctionBodyHook()
_importedScriptsTemp = _block->newTemp();
_idArrayTemp = _block->newTemp();
- IR::Temp *temp = _block->TEMP(_contextObjectTemp);
+ QV4::IR::Temp *temp = _block->TEMP(_contextObjectTemp);
initMetaObjectResolver(&temp->memberResolver, _contextObject);
- move(temp, _block->NAME(IR::Name::builtin_qml_context_object, 0, 0));
+ move(temp, _block->NAME(QV4::IR::Name::builtin_qml_context_object, 0, 0));
temp = _block->TEMP(_scopeObjectTemp);
initMetaObjectResolver(&temp->memberResolver, _scopeObject);
- move(temp, _block->NAME(IR::Name::builtin_qml_scope_object, 0, 0));
+ move(temp, _block->NAME(QV4::IR::Name::builtin_qml_scope_object, 0, 0));
- move(_block->TEMP(_importedScriptsTemp), _block->NAME(IR::Name::builtin_qml_imported_scripts_object, 0, 0));
- move(_block->TEMP(_idArrayTemp), _block->NAME(IR::Name::builtin_qml_id_array, 0, 0));
+ move(_block->TEMP(_importedScriptsTemp), _block->NAME(QV4::IR::Name::builtin_qml_imported_scripts_object, 0, 0));
+ move(_block->TEMP(_idArrayTemp), _block->NAME(QV4::IR::Name::builtin_qml_id_array, 0, 0));
}
-IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
+QV4::IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
{
if (_disableAcceleratedLookups)
return 0;
@@ -1710,8 +1701,8 @@ IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
foreach (const IdMapping &mapping, _idObjects)
if (name == mapping.name) {
_function->idObjectDependencies.insert(mapping.idIndex);
- IR::Expr *s = subscript(_block->TEMP(_idArrayTemp), _block->CONST(IR::SInt32Type, mapping.idIndex));
- IR::Temp *result = _block->TEMP(_block->newTemp());
+ QV4::IR::Expr *s = subscript(_block->TEMP(_idArrayTemp), _block->CONST(QV4::IR::SInt32Type, mapping.idIndex));
+ QV4::IR::Temp *result = _block->TEMP(_block->newTemp());
_block->MOVE(result, s);
result = _block->TEMP(result->index);
if (mapping.type) {
@@ -1726,13 +1717,13 @@ IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
QQmlTypeNameCache::Result r = imports->query(name);
if (r.isValid()) {
if (r.scriptIndex != -1) {
- return subscript(_block->TEMP(_importedScriptsTemp), _block->CONST(IR::SInt32Type, r.scriptIndex));
+ return subscript(_block->TEMP(_importedScriptsTemp), _block->CONST(QV4::IR::SInt32Type, r.scriptIndex));
} else if (r.type) {
- IR::Name *typeName = _block->NAME(name, line, col);
+ QV4::IR::Name *typeName = _block->NAME(name, line, col);
// Make sure the run-time loads this through the more efficient singleton getter.
typeName->qmlSingleton = r.type->isCompositeSingleton();
typeName->freeOfSideEffects = true;
- IR::Temp *result = _block->TEMP(_block->newTemp());
+ QV4::IR::Temp *result = _block->TEMP(_block->newTemp());
_block->MOVE(result, typeName);
result = _block->TEMP(result->index);
@@ -1740,9 +1731,9 @@ IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
return result;
} else {
Q_ASSERT(r.importNamespace);
- IR::Name *namespaceName = _block->NAME(name, line, col);
+ QV4::IR::Name *namespaceName = _block->NAME(name, line, col);
namespaceName->freeOfSideEffects = true;
- IR::Temp *result = _block->TEMP(_block->newTemp());
+ QV4::IR::Temp *result = _block->TEMP(_block->newTemp());
initImportNamespaceResolver(&result->memberResolver, imports, r.importNamespace);
_block->MOVE(result, namespaceName);
@@ -1757,9 +1748,9 @@ IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
if (propertyExistsButForceNameLookup)
return 0;
if (pd) {
- IR::Temp *base = _block->TEMP(_scopeObjectTemp);
+ QV4::IR::Temp *base = _block->TEMP(_scopeObjectTemp);
initMetaObjectResolver(&base->memberResolver, _scopeObject);
- return _block->MEMBER(base, _function->newString(name), pd, IR::Member::MemberOfQmlScopeObject);
+ return _block->MEMBER(base, _function->newString(name), pd, QV4::IR::Member::MemberOfQmlScopeObject);
}
}
@@ -1769,9 +1760,9 @@ IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col)
if (propertyExistsButForceNameLookup)
return 0;
if (pd) {
- IR::Temp *base = _block->TEMP(_contextObjectTemp);
+ QV4::IR::Temp *base = _block->TEMP(_contextObjectTemp);
initMetaObjectResolver(&base->memberResolver, _contextObject);
- return _block->MEMBER(base, _function->newString(name), pd, IR::Member::MemberOfQmlContextObject);
+ return _block->MEMBER(base, _function->newString(name), pd, QV4::IR::Member::MemberOfQmlContextObject);
}
}
diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h
index 583f8e1ed5..8bcadb7a54 100644
--- a/src/qml/compiler/qqmlcodegenerator_p.h
+++ b/src/qml/compiler/qqmlcodegenerator_p.h
@@ -57,28 +57,7 @@ QT_BEGIN_NAMESPACE
class QQmlTypeNameCache;
-namespace QtQml {
-
-using namespace QV4;
-
-struct DebugStream
-{
- DebugStream(QTextStream &stream)
- : stream(stream)
- , indent(0)
- {}
-
- template <typename T>
- QTextStream &operator<<(const T &value)
- {
- return stream << QByteArray(indent * 4, ' ') << value;
- }
-
- QTextStream &noindent() { return stream; }
-
- QTextStream &stream;
- int indent;
-};
+namespace QmlIR {
template <typename T>
struct PoolList
@@ -206,7 +185,7 @@ public:
}
};
-struct QmlObject;
+struct Object;
struct SignalParameter : public QV4::CompiledData::Parameter
{
@@ -224,9 +203,9 @@ struct Signal
Signal *next;
};
-struct QmlProperty : public QV4::CompiledData::Property
+struct Property : public QV4::CompiledData::Property
{
- QmlProperty *next;
+ Property *next;
};
struct Binding : public QV4::CompiledData::Binding
@@ -264,9 +243,9 @@ struct CompiledFunctionOrExpression
CompiledFunctionOrExpression *next;
};
-struct QmlObject
+struct Object
{
- Q_DECLARE_TR_FUNCTIONS(QmlObject)
+ Q_DECLARE_TR_FUNCTIONS(Object)
public:
quint32 inheritedTypeNameIndex;
quint32 idIndex;
@@ -275,7 +254,7 @@ public:
QV4::CompiledData::Location location;
QV4::CompiledData::Location locationOfIdProperty;
- const QmlProperty *firstProperty() const { return properties->first; }
+ const Property *firstProperty() const { return properties->first; }
int propertyCount() const { return properties->count; }
const Signal *firstSignal() const { return qmlSignals->first; }
int signalCount() const { return qmlSignals->count; }
@@ -286,17 +265,15 @@ public:
// If set, then declarations for this object (and init bindings for these) should go into the
// specified object. Used for declarations inside group properties.
- QmlObject *declarationsOverride;
+ Object *declarationsOverride;
void init(QQmlJS::MemoryPool *pool, int typeNameIndex, int id, const QQmlJS::AST::SourceLocation &location = QQmlJS::AST::SourceLocation());
- void dump(DebugStream &out);
-
QString sanityCheckFunctionNames(const QSet<QString> &illegalNames, QQmlJS::AST::SourceLocation *errorLocation);
QString appendSignal(Signal *signal);
- QString appendProperty(QmlProperty *prop, const QString &propertyName, bool isDefaultProperty, const QQmlJS::AST::SourceLocation &defaultToken, QQmlJS::AST::SourceLocation *errorLocation);
- void appendFunction(QtQml::Function *f);
+ QString appendProperty(Property *prop, const QString &propertyName, bool isDefaultProperty, const QQmlJS::AST::SourceLocation &defaultToken, QQmlJS::AST::SourceLocation *errorLocation);
+ void appendFunction(QmlIR::Function *f);
QString appendBinding(Binding *b, bool isListBinding);
Binding *findBinding(quint32 nameIndex) const;
@@ -307,7 +284,7 @@ public:
FixedPoolArray<int> *runtimeFunctionIndices;
private:
- PoolList<QmlProperty> *properties;
+ PoolList<Property> *properties;
PoolList<Signal> *qmlSignals;
PoolList<Binding> *bindings;
PoolList<Function> *functions;
@@ -336,7 +313,7 @@ struct ParsedQML
QList<Pragma*> pragmas;
QQmlJS::AST::UiProgram *program;
int indexOfRootObject;
- QList<QmlObject*> objects;
+ QList<Object*> objects;
QV4::Compiler::JSUnitGenerator jsGenerator;
QV4::CompiledData::TypeReferenceMap typeReferences;
@@ -376,8 +353,8 @@ public:
void accept(QQmlJS::AST::Node *node);
// returns index in _objects
- bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, QmlObject *declarationsOverride = 0);
- bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiObjectDefinition *node, QmlObject *declarationsOverride = 0)
+ bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, Object *declarationsOverride = 0);
+ bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiObjectDefinition *node, Object *declarationsOverride = 0)
{ return defineQMLObject(objectIndex, node->qualifiedTypeNameId, node->qualifiedTypeNameId->firstSourceLocation(), node->initializer, declarationsOverride); }
static QString asString(QQmlJS::AST::UiQualifiedId *node);
@@ -399,13 +376,13 @@ public:
void appendBinding(const QQmlJS::AST::SourceLocation &qualifiedNameLocation, const QQmlJS::AST::SourceLocation &nameLocation, quint32 propertyNameIndex, QQmlJS::AST::Statement *value);
void appendBinding(const QQmlJS::AST::SourceLocation &qualifiedNameLocation, const QQmlJS::AST::SourceLocation &nameLocation, quint32 propertyNameIndex, int objectIndex, bool isListItem = false, bool isOnAssignment = false);
- QmlObject *bindingsTarget() const;
+ Object *bindingsTarget() const;
bool setId(const QQmlJS::AST::SourceLocation &idLocation, QQmlJS::AST::Statement *value);
// resolves qualified name (font.pixelSize for example) and returns the last name along
// with the object any right-hand-side of a binding should apply to.
- bool resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, QmlObject **object, bool onAssignment = false);
+ bool resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, Object **object, bool onAssignment = false);
void recordError(const QQmlJS::AST::SourceLocation &location, const QString &description);
@@ -426,12 +403,12 @@ public:
QList<QV4::CompiledData::Import*> _imports;
QList<Pragma*> _pragmas;
- QList<QmlObject*> _objects;
+ QList<Object*> _objects;
QV4::CompiledData::TypeReferenceMap _typeReferences;
- QmlObject *_object;
- QmlProperty *_propertyDeclaration;
+ Object *_object;
+ Property *_propertyDeclaration;
QQmlJS::MemoryPool *pool;
QString sourceCode;
@@ -450,7 +427,7 @@ struct Q_QML_EXPORT QmlUnitGenerator
private:
typedef bool (Binding::*BindingFilter)() const;
- char *writeBindings(char *bindingPtr, QmlObject *o, BindingFilter filter) const;
+ char *writeBindings(char *bindingPtr, Object *o, BindingFilter filter) const;
int getStringId(const QString &str) const;
@@ -478,7 +455,7 @@ struct PropertyResolver
struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen
{
- JSCodeGen(const QString &fileName, const QString &sourceCode, IR::Module *jsModule,
+ JSCodeGen(const QString &fileName, const QString &sourceCode, QV4::IR::Module *jsModule,
QQmlJS::Engine *jsEngine, QQmlJS::AST::UiProgram *qmlRoot, QQmlTypeNameCache *imports,
const QStringList &stringPool);
@@ -498,7 +475,7 @@ struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen
protected:
virtual void beginFunctionBodyHook();
- virtual IR::Expr *fallbackNameLookup(const QString &name, int line, int col);
+ virtual QV4::IR::Expr *fallbackNameLookup(const QString &name, int line, int col);
private:
QQmlPropertyData *lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name, bool *propertyExistsButForceNameLookup = 0);
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 14043ce25b..9a132dcbbc 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-QQmlTypeCompiler::QQmlTypeCompiler(QQmlEnginePrivate *engine, QQmlCompiledData *compiledData, QQmlTypeData *typeData, QtQml::ParsedQML *parsedQML)
+QQmlTypeCompiler::QQmlTypeCompiler(QQmlEnginePrivate *engine, QQmlCompiledData *compiledData, QQmlTypeData *typeData, QmlIR::ParsedQML *parsedQML)
: engine(engine)
, compiledData(compiledData)
, typeData(typeData)
@@ -203,7 +203,7 @@ bool QQmlTypeCompiler::compile()
// Compile JS binding expressions and signal handlers
{
- QtQml::JSCodeGen v4CodeGenerator(typeData->finalUrlString(), parsedQML->code, &parsedQML->jsModule, &parsedQML->jsParserEngine, parsedQML->program, compiledData->importCache, parsedQML->jsGenerator.strings);
+ QmlIR::JSCodeGen v4CodeGenerator(typeData->finalUrlString(), parsedQML->code, &parsedQML->jsModule, &parsedQML->jsParserEngine, parsedQML->program, compiledData->importCache, parsedQML->jsGenerator.strings);
QQmlJSCodeGenerator jsCodeGen(this, &v4CodeGenerator);
if (!jsCodeGen.generateCodeForComponents())
return false;
@@ -216,13 +216,13 @@ bool QQmlTypeCompiler::compile()
QV4::ExecutionEngine *v4 = engine->v4engine();
- QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(engine, v4->executableAllocator, &parsedQML->jsModule, &parsedQML->jsGenerator));
+ QScopedPointer<QV4::EvalInstructionSelection> isel(v4->iselFactory->create(engine, v4->executableAllocator, &parsedQML->jsModule, &parsedQML->jsGenerator));
isel->setUseFastLookups(false);
QV4::CompiledData::CompilationUnit *jsUnit = isel->compile(/*generated unit data*/false);
// Generate QML compiled type data structures
- QmlUnitGenerator qmlGenerator;
+ QmlIR::QmlUnitGenerator qmlGenerator;
QV4::CompiledData::QmlUnit *qmlUnit = qmlGenerator.generate(*parsedQML);
if (jsUnit) {
@@ -323,7 +323,7 @@ QHash<int, QQmlCompiledData::TypeReference*> *QQmlTypeCompiler::resolvedTypes()
return &compiledData->resolvedTypes;
}
-QList<QmlObject *> *QQmlTypeCompiler::qmlObjects()
+QList<QmlIR::Object *> *QQmlTypeCompiler::qmlObjects()
{
return &parsedQML->objects;
}
@@ -448,7 +448,7 @@ bool QQmlPropertyCacheCreator::buildMetaObjects()
bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int referencingObjectIndex, const QV4::CompiledData::Binding *instantiatingBinding)
{
- const QmlObject *obj = qmlObjects.at(objectIndex);
+ const QmlIR::Object *obj = qmlObjects.at(objectIndex);
QQmlPropertyCache *baseTypeCache = 0;
QQmlPropertyData *instantiatingProperty = 0;
@@ -459,7 +459,7 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
Q_ASSERT(instantiatingBinding->propertyNameIndex != 0);
bool notInRevision = false;
- instantiatingProperty = PropertyResolver(parentCache).property(stringAt(instantiatingBinding->propertyNameIndex), &notInRevision);
+ instantiatingProperty = QmlIR::PropertyResolver(parentCache).property(stringAt(instantiatingBinding->propertyNameIndex), &notInRevision);
if (instantiatingProperty) {
if (instantiatingProperty->isQObject()) {
baseTypeCache = enginePrivate->rawPropertyCacheForType(instantiatingProperty->propType);
@@ -473,7 +473,7 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
bool needVMEMetaObject = obj->propertyCount() != 0 || obj->signalCount() != 0 || obj->functionCount() != 0;
if (!needVMEMetaObject) {
- for (const QtQml::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
+ for (const QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
if (binding->type == QV4::CompiledData::Binding::Type_Object && (binding->flags & QV4::CompiledData::Binding::IsOnAssignment)) {
// On assignments are implemented using value interceptors, which require a VME meta object.
@@ -535,7 +535,7 @@ bool QQmlPropertyCacheCreator::buildMetaObjectRecursively(int objectIndex, int r
}
if (propertyCaches.at(objectIndex)) {
- for (const QtQml::Binding *binding = obj->firstBinding(); binding; binding = binding->next)
+ for (const QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next)
if (binding->type >= QV4::CompiledData::Binding::Type_Object) {
if (!buildMetaObjectRecursively(binding->value.objectIndex, objectIndex, binding))
return false;
@@ -549,14 +549,14 @@ bool QQmlPropertyCacheCreator::ensureMetaObject(int objectIndex)
{
if (!vmeMetaObjects.at(objectIndex).isEmpty())
return true;
- const QtQml::QmlObject *obj = qmlObjects.at(objectIndex);
+ const QmlIR::Object *obj = qmlObjects.at(objectIndex);
QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(obj->inheritedTypeNameIndex);
Q_ASSERT(typeRef);
QQmlPropertyCache *baseTypeCache = typeRef->createPropertyCache(QQmlEnginePrivate::get(enginePrivate));
return createMetaObject(objectIndex, obj, baseTypeCache);
}
-bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::QmlObject *obj, QQmlPropertyCache *baseTypeCache)
+bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QmlIR::Object *obj, QQmlPropertyCache *baseTypeCache)
{
QQmlPropertyCache *cache = baseTypeCache->copyAndReserve(QQmlEnginePrivate::get(enginePrivate),
obj->propertyCount(),
@@ -614,9 +614,9 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
int aliasCount = 0;
int varPropCount = 0;
- PropertyResolver resolver(baseTypeCache);
+ QmlIR::PropertyResolver resolver(baseTypeCache);
- for (const QtQml::QmlProperty *p = obj->firstProperty(); p; p = p->next) {
+ for (const QmlIR::Property *p = obj->firstProperty(); p; p = p->next) {
if (p->type == QV4::CompiledData::Property::Alias)
aliasCount++;
else if (p->type == QV4::CompiledData::Property::Var)
@@ -669,7 +669,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
if (ii == NSS_Var && varPropCount == 0) continue;
else if (ii == NSS_Alias && aliasCount == 0) continue;
- for (const QtQml::QmlProperty *p = obj->firstProperty(); p; p = p->next) {
+ for (const QmlIR::Property *p = obj->firstProperty(); p; p = p->next) {
if ((ii == NSS_Normal && (p->type == QV4::CompiledData::Property::Alias ||
p->type == QV4::CompiledData::Property::Var)) ||
((ii == NSS_Var) && (p->type != QV4::CompiledData::Property::Var)) ||
@@ -687,7 +687,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
}
// Dynamic signals
- for (const QtQml::Signal *s = obj->firstSignal(); s; s = s->next) {
+ for (const QmlIR::Signal *s = obj->firstSignal(); s; s = s->next) {
const int paramCount = s->parameters->count;
QList<QByteArray> names;
@@ -696,7 +696,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
if (paramCount) {
paramTypes[0] = paramCount;
- QtQml::SignalParameter *param = s->parameters->first;
+ QmlIR::SignalParameter *param = s->parameters->first;
for (int i = 0; i < paramCount; ++i, param = param->next) {
names.append(stringAt(param->nameIndex).toUtf8());
if (param->type < builtinTypeCount) {
@@ -745,7 +745,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
// Dynamic slots
- for (const QtQml::Function *s = obj->firstFunction(); s; s = s->next) {
+ for (const QmlIR::Function *s = obj->firstFunction(); s; s = s->next) {
QQmlJS::AST::FunctionDeclaration *astFunction = s->functionDeclaration;
quint32 flags = QQmlPropertyData::IsFunction | QQmlPropertyData::IsVMEFunction;
@@ -773,7 +773,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
// Dynamic properties (except var and aliases)
int effectiveSignalIndex = cache->signalHandlerIndexCacheStart;
int propertyIdx = 0;
- for (const QtQml::QmlProperty *p = obj->firstProperty(); p; p = p->next, ++propertyIdx) {
+ for (const QmlIR::Property *p = obj->firstProperty(); p; p = p->next, ++propertyIdx) {
if (p->type == QV4::CompiledData::Property::Alias ||
p->type == QV4::CompiledData::Property::Var)
@@ -849,7 +849,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
// Now do var properties
propertyIdx = 0;
- for (const QtQml::QmlProperty *p = obj->firstProperty(); p; p = p->next, ++propertyIdx) {
+ for (const QmlIR::Property *p = obj->firstProperty(); p; p = p->next, ++propertyIdx) {
if (p->type != QV4::CompiledData::Property::Var)
continue;
@@ -875,7 +875,7 @@ bool QQmlPropertyCacheCreator::createMetaObject(int objectIndex, const QtQml::Qm
((QQmlVMEMetaData *)dynamicData.data())->aliasCount = aliasCount;
// Dynamic slot data - comes after the property data
- for (const QtQml::Function *s = obj->firstFunction(); s; s = s->next) {
+ for (const QmlIR::Function *s = obj->firstFunction(); s; s = s->next) {
QQmlJS::AST::FunctionDeclaration *astFunction = s->functionDeclaration;
int formalsCount = 0;
QQmlJS::AST::FormalParameterList *param = astFunction->formals;
@@ -910,7 +910,7 @@ SignalHandlerConverter::SignalHandlerConverter(QQmlTypeCompiler *typeCompiler)
bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclarations()
{
for (int objectIndex = 0; objectIndex < qmlObjects.count(); ++objectIndex) {
- const QmlObject * const obj = qmlObjects.at(objectIndex);
+ const QmlIR::Object * const obj = qmlObjects.at(objectIndex);
QQmlPropertyCache *cache = propertyCaches.at(objectIndex);
if (!cache)
continue;
@@ -925,16 +925,16 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
return true;
}
-bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclarations(const QmlObject *obj, const QString &typeName, QQmlPropertyCache *propertyCache)
+bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclarations(const QmlIR::Object *obj, const QString &typeName, QQmlPropertyCache *propertyCache)
{
// map from signal name defined in qml itself to list of parameters
QHash<QString, QStringList> customSignals;
- for (Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
+ for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
QString propertyName = stringAt(binding->propertyNameIndex);
// Attached property?
if (binding->type == QV4::CompiledData::Binding::Type_AttachedProperty) {
- const QmlObject *attachedObj = qmlObjects.at(binding->value.objectIndex);
+ const QmlIR::Object *attachedObj = qmlObjects.at(binding->value.objectIndex);
QQmlCompiledData::TypeReference *typeRef = resolvedTypes.value(binding->propertyNameIndex);
QQmlType *type = typeRef ? typeRef->type : 0;
const QMetaObject *attachedType = type ? type->attachedPropertiesType() : 0;
@@ -946,10 +946,10 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
continue;
}
- if (!QQmlCodeGenerator::isSignalPropertyName(propertyName))
+ if (!QmlIR::QQmlCodeGenerator::isSignalPropertyName(propertyName))
continue;
- PropertyResolver resolver(propertyCache);
+ QmlIR::PropertyResolver resolver(propertyCache);
Q_ASSERT(propertyName.startsWith(QStringLiteral("on")));
propertyName.remove(0, 2);
@@ -1006,12 +1006,12 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
// build cache if necessary
if (customSignals.isEmpty()) {
- for (const Signal *signal = obj->firstSignal(); signal; signal = signal->next) {
+ for (const QmlIR::Signal *signal = obj->firstSignal(); signal; signal = signal->next) {
const QString &signalName = stringAt(signal->nameIndex);
customSignals.insert(signalName, signal->parameterStringList(compiler->stringPool()));
}
- for (const QmlProperty *property = obj->firstProperty(); property; property = property->next) {
+ for (const QmlIR::Property *property = obj->firstProperty(); property; property = property->next) {
const QString propName = stringAt(property->nameIndex);
customSignals.insert(propName, QStringList());
}
@@ -1061,7 +1061,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio
if (paramList)
paramList = paramList->finish();
- CompiledFunctionOrExpression *foe = obj->functionsAndExpressions->slowAt(binding->value.compiledScriptIndex);
+ QmlIR::CompiledFunctionOrExpression *foe = obj->functionsAndExpressions->slowAt(binding->value.compiledScriptIndex);
QQmlJS::AST::Statement *statement = static_cast<QQmlJS::AST::Statement*>(foe->node);
QQmlJS::AST::SourceElement *sourceElement = new (pool) QQmlJS::AST::StatementSourceElement(statement);
QQmlJS::AST::SourceElements *elements = new (pool) QQmlJS::AST::SourceElements(sourceElement);
@@ -1094,11 +1094,11 @@ bool QQmlEnumTypeResolver::resolveEnumBindings()
QQmlPropertyCache *propertyCache = propertyCaches.at(i);
if (!propertyCache)
continue;
- const QmlObject *obj = qmlObjects.at(i);
+ const QmlIR::Object *obj = qmlObjects.at(i);
- PropertyResolver resolver(propertyCache);
+ QmlIR::PropertyResolver resolver(propertyCache);
- for (QtQml::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
+ for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression
|| binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject)
continue;
@@ -1129,7 +1129,7 @@ struct StaticQtMetaObject : public QObject
{ return &staticQtMetaObject; }
};
-bool QQmlEnumTypeResolver::tryQualifiedEnumAssignment(const QmlObject *obj, const QQmlPropertyCache *propertyCache, const QQmlPropertyData *prop, Binding *binding)
+bool QQmlEnumTypeResolver::tryQualifiedEnumAssignment(const QmlIR::Object *obj, const QQmlPropertyCache *propertyCache, const QQmlPropertyData *prop, QmlIR::Binding *binding)
{
bool isIntProp = (prop->propType == QMetaType::Int) && !prop->isEnum();
if (!prop->isEnum() && !isIntProp)
@@ -1244,12 +1244,12 @@ void QQmlAliasAnnotator::annotateBindingsToAliases()
if (!propertyCache)
continue;
- const QmlObject *obj = qmlObjects.at(i);
+ const QmlIR::Object *obj = qmlObjects.at(i);
- PropertyResolver resolver(propertyCache);
+ QmlIR::PropertyResolver resolver(propertyCache);
QQmlPropertyData *defaultProperty = obj->indexOfDefaultProperty != -1 ? propertyCache->parent()->defaultProperty() : propertyCache->defaultProperty();
- for (QtQml::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
+ for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
if (!binding->isValueBinding())
continue;
bool notInRevision = false;
@@ -1276,19 +1276,19 @@ QQmlComponentAndAliasResolver::QQmlComponentAndAliasResolver(QQmlTypeCompiler *t
{
}
-void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQml::QmlObject *obj, QQmlPropertyCache *propertyCache)
+void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlIR::Object *obj, QQmlPropertyCache *propertyCache)
{
- PropertyResolver propertyResolver(propertyCache);
+ QmlIR::PropertyResolver propertyResolver(propertyCache);
QQmlPropertyData *defaultProperty = obj->indexOfDefaultProperty != -1 ? propertyCache->parent()->defaultProperty() : propertyCache->defaultProperty();
- for (QtQml::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
+ for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
if (binding->type != QV4::CompiledData::Binding::Type_Object)
continue;
if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject)
continue;
- const QtQml::QmlObject *targetObject = qmlObjects->at(binding->value.objectIndex);
+ const QmlIR::Object *targetObject = qmlObjects->at(binding->value.objectIndex);
QQmlCompiledData::TypeReference *tr = resolvedTypes->value(targetObject->inheritedTypeNameIndex);
Q_ASSERT(tr);
if (QQmlType *targetType = tr->type) {
@@ -1323,7 +1323,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQm
static QQmlType *componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject);
Q_ASSERT(componentType);
- QtQml::QmlObject *syntheticComponent = pool->New<QtQml::QmlObject>();
+ QmlIR::Object *syntheticComponent = pool->New<QmlIR::Object>();
syntheticComponent->init(pool, compiler->registerString(QString::fromUtf8(componentType->typeName())), compiler->registerString(QString()));
if (!resolvedTypes->contains(syntheticComponent->inheritedTypeNameIndex)) {
@@ -1337,7 +1337,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QtQm
qmlObjects->append(syntheticComponent);
const int componentIndex = qmlObjects->count() - 1;
- QtQml::Binding *syntheticBinding = pool->New<QtQml::Binding>();
+ QmlIR::Binding *syntheticBinding = pool->New<QmlIR::Binding>();
*syntheticBinding = *binding;
syntheticBinding->type = QV4::CompiledData::Binding::Type_Object;
QString error = syntheticComponent->appendBinding(syntheticBinding, /*isListBinding*/false);
@@ -1359,7 +1359,7 @@ bool QQmlComponentAndAliasResolver::resolve()
// on the left hand side is of QQmlComponent type.
const int objCountWithoutSynthesizedComponents = qmlObjects->count();
for (int i = 0; i < objCountWithoutSynthesizedComponents; ++i) {
- const QtQml::QmlObject *obj = qmlObjects->at(i);
+ const QmlIR::Object *obj = qmlObjects->at(i);
QQmlPropertyCache *cache = propertyCaches.value(i);
if (obj->inheritedTypeNameIndex == 0 && !cache)
continue;
@@ -1389,9 +1389,9 @@ bool QQmlComponentAndAliasResolver::resolve()
if (obj->bindingCount() == 0)
COMPILE_EXCEPTION(obj, tr("Cannot create empty component specification"));
- const QtQml::Binding *rootBinding = obj->firstBinding();
+ const QmlIR::Binding *rootBinding = obj->firstBinding();
- for (const QtQml::Binding *b = rootBinding; b; b = b->next) {
+ for (const QmlIR::Binding *b = rootBinding; b; b = b->next) {
if (b->propertyNameIndex != 0)
COMPILE_EXCEPTION(rootBinding, tr("Component elements may not contain properties other than id"));
}
@@ -1405,8 +1405,8 @@ bool QQmlComponentAndAliasResolver::resolve()
std::sort(componentBoundaries.begin(), componentBoundaries.end());
for (int i = 0; i < componentRoots.count(); ++i) {
- const QtQml::QmlObject *component = qmlObjects->at(componentRoots.at(i));
- const QtQml::Binding *rootBinding = component->firstBinding();
+ const QmlIR::Object *component = qmlObjects->at(componentRoots.at(i));
+ const QmlIR::Binding *rootBinding = component->firstBinding();
_componentIndex = i;
_idToObjectIndex.clear();
@@ -1437,7 +1437,7 @@ bool QQmlComponentAndAliasResolver::resolve()
bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex)
{
- const QtQml::QmlObject *obj = qmlObjects->at(objectIndex);
+ const QmlIR::Object *obj = qmlObjects->at(objectIndex);
if (obj->idIndex != 0) {
if (_idToObjectIndex.contains(obj->idIndex)) {
@@ -1448,14 +1448,14 @@ bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex)
_objectIndexToIdInScope->insert(objectIndex, _objectIndexToIdInScope->count());
}
- for (const QtQml::QmlProperty *property = obj->firstProperty(); property; property = property->next) {
+ for (const QmlIR::Property *property = obj->firstProperty(); property; property = property->next) {
if (property->type == QV4::CompiledData::Property::Alias) {
_objectsWithAliases.append(objectIndex);
break;
}
}
- for (const QtQml::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
+ for (const QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
if (binding->type != QV4::CompiledData::Binding::Type_Object
&& binding->type != QV4::CompiledData::Binding::Type_AttachedProperty
&& binding->type != QV4::CompiledData::Binding::Type_GroupProperty)
@@ -1475,7 +1475,7 @@ bool QQmlComponentAndAliasResolver::collectIdsAndAliases(int objectIndex)
bool QQmlComponentAndAliasResolver::resolveAliases()
{
foreach (int objectIndex, _objectsWithAliases) {
- const QtQml::QmlObject *obj = qmlObjects->at(objectIndex);
+ const QmlIR::Object *obj = qmlObjects->at(objectIndex);
QQmlPropertyCache *propertyCache = propertyCaches.value(objectIndex);
Q_ASSERT(propertyCache);
@@ -1484,7 +1484,7 @@ bool QQmlComponentAndAliasResolver::resolveAliases()
int effectivePropertyIndex = propertyCache->propertyIndexCacheStart + propertyCache->propertyIndexCache.count();
int effectiveAliasIndex = 0;
- const QtQml::QmlProperty *p = obj->firstProperty();
+ const QmlIR::Property *p = obj->firstProperty();
for (int propertyIndex = 0; propertyIndex < obj->propertyCount(); ++propertyIndex, p = p->next) {
if (p->type != QV4::CompiledData::Property::Alias)
continue;
@@ -1521,7 +1521,7 @@ bool QQmlComponentAndAliasResolver::resolveAliases()
quint32 propertyFlags = QQmlPropertyData::IsAlias;
if (property.isEmpty()) {
- const QtQml::QmlObject *targetObject = qmlObjects->at(targetObjectIndex);
+ const QmlIR::Object *targetObject = qmlObjects->at(targetObjectIndex);
QQmlCompiledData::TypeReference *typeRef = resolvedTypes->value(targetObject->inheritedTypeNameIndex);
Q_ASSERT(typeRef);
@@ -1535,7 +1535,7 @@ bool QQmlComponentAndAliasResolver::resolveAliases()
} else {
QQmlPropertyCache *targetCache = propertyCaches.value(targetObjectIndex);
Q_ASSERT(targetCache);
- QtQml::PropertyResolver resolver(targetCache);
+ QmlIR::PropertyResolver resolver(targetCache);
QQmlPropertyData *targetProperty = resolver.property(property.toString());
if (!targetProperty || targetProperty->coreIndex > 0x0000FFFF) {
@@ -1648,12 +1648,12 @@ const QQmlImports &QQmlPropertyValidator::imports() const
QQmlJS::AST::Node *QQmlPropertyValidator::astForBinding(int objectIndex, int scriptIndex) const
{
- const QtQml::QmlObject *obj = compiler->qmlObjects()->at(objectIndex);
+ const QmlIR::Object *obj = compiler->qmlObjects()->at(objectIndex);
// ####
int reverseIndex = obj->runtimeFunctionIndices->indexOf(scriptIndex);
if (reverseIndex == -1)
return 0;
- QtQml::CompiledFunctionOrExpression *foe = obj->functionsAndExpressions->slowAt(reverseIndex);
+ QmlIR::CompiledFunctionOrExpression *foe = obj->functionsAndExpressions->slowAt(reverseIndex);
return foe ? foe->node : 0;
}
@@ -1725,7 +1725,7 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
QBitArray customParserBindings(obj->nBindings);
QBitArray deferredBindings;
- PropertyResolver propertyResolver(propertyCache);
+ QmlIR::PropertyResolver propertyResolver(propertyCache);
QString defaultPropertyName;
QQmlPropertyData *defaultProperty = 0;
@@ -1749,7 +1749,7 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
customParserBindings.setBit(i);
continue;
}
- } else if (QQmlCodeGenerator::isSignalPropertyName(name)
+ } else if (QmlIR::QQmlCodeGenerator::isSignalPropertyName(name)
&& !(customParser->flags() & QQmlCustomParser::AcceptsSignalHandlers)) {
customBindings << binding;
customParserBindings.setBit(i);
@@ -2311,7 +2311,7 @@ bool QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData *property, co
return true;
}
-QQmlJSCodeGenerator::QQmlJSCodeGenerator(QQmlTypeCompiler *typeCompiler, QtQml::JSCodeGen *v4CodeGen)
+QQmlJSCodeGenerator::QQmlJSCodeGenerator(QQmlTypeCompiler *typeCompiler, QmlIR::JSCodeGen *v4CodeGen)
: QQmlCompilePass(typeCompiler)
, objectIndexToIdPerComponent(*typeCompiler->objectIndexToIdPerComponent())
, resolvedTypes(*typeCompiler->resolvedTypes())
@@ -2337,14 +2337,14 @@ bool QQmlJSCodeGenerator::generateCodeForComponents()
bool QQmlJSCodeGenerator::compileComponent(int contextObject, const QHash<int, int> &objectIndexToId)
{
if (isComponent(contextObject)) {
- const QtQml::QmlObject *component = qmlObjects.at(contextObject);
+ const QmlIR::Object *component = qmlObjects.at(contextObject);
Q_ASSERT(component->bindingCount() == 1);
const QV4::CompiledData::Binding *componentBinding = component->firstBinding();
Q_ASSERT(componentBinding->type == QV4::CompiledData::Binding::Type_Object);
contextObject = componentBinding->value.objectIndex;
}
- JSCodeGen::ObjectIdMapping idMapping;
+ QmlIR::JSCodeGen::ObjectIdMapping idMapping;
if (!objectIndexToId.isEmpty()) {
idMapping.reserve(objectIndexToId.count());
@@ -2352,8 +2352,8 @@ bool QQmlJSCodeGenerator::compileComponent(int contextObject, const QHash<int, i
idIt != end; ++idIt) {
const int objectIndex = idIt.key();
- JSCodeGen::IdMapping m;
- const QtQml::QmlObject *obj = qmlObjects.at(objectIndex);
+ QmlIR::JSCodeGen::IdMapping m;
+ const QmlIR::Object *obj = qmlObjects.at(objectIndex);
m.name = stringAt(obj->idIndex);
m.idIndex = idIt.value();
m.type = propertyCaches.at(objectIndex);
@@ -2378,13 +2378,13 @@ bool QQmlJSCodeGenerator::compileJavaScriptCodeInObjectsRecursively(int objectIn
if (isComponent(objectIndex))
return true;
- QtQml::QmlObject *object = qmlObjects.at(objectIndex);
+ QmlIR::Object *object = qmlObjects.at(objectIndex);
if (object->functionsAndExpressions->count > 0) {
QQmlPropertyCache *scopeObject = propertyCaches.at(scopeObjectIndex);
v4CodeGen->beginObjectScope(scopeObject);
- QList<QtQml::CompiledFunctionOrExpression> functionsToCompile;
- for (QtQml::CompiledFunctionOrExpression *foe = object->functionsAndExpressions->first; foe; foe = foe->next) {
+ QList<QmlIR::CompiledFunctionOrExpression> functionsToCompile;
+ for (QmlIR::CompiledFunctionOrExpression *foe = object->functionsAndExpressions->first; foe; foe = foe->next) {
const bool haveCustomParser = customParsers.contains(object->inheritedTypeNameIndex);
if (haveCustomParser)
foe->disableAcceleratedLookups = true;
@@ -2399,11 +2399,11 @@ bool QQmlJSCodeGenerator::compileJavaScriptCodeInObjectsRecursively(int objectIn
}
QQmlJS::MemoryPool *pool = compiler->memoryPool();
- object->runtimeFunctionIndices = pool->New<QtQml::FixedPoolArray<int> >();
+ object->runtimeFunctionIndices = pool->New<QmlIR::FixedPoolArray<int> >();
object->runtimeFunctionIndices->init(pool, runtimeFunctionIndices);
}
- for (const QtQml::Binding *binding = object->firstBinding(); binding; binding = binding->next) {
+ for (const QmlIR::Binding *binding = object->firstBinding(); binding; binding = binding->next) {
if (binding->type < QV4::CompiledData::Binding::Type_Object)
continue;
@@ -2437,14 +2437,14 @@ void QQmlDefaultPropertyMerger::mergeDefaultProperties(int objectIndex)
if (!propertyCache)
return;
- QmlObject *object = qmlObjects.at(objectIndex);
+ QmlIR::Object *object = qmlObjects.at(objectIndex);
QString defaultProperty = object->indexOfDefaultProperty != -1 ? propertyCache->parent()->defaultPropertyName() : propertyCache->defaultPropertyName();
- Binding *bindingsToReinsert = 0;
- Binding *tail = 0;
+ QmlIR::Binding *bindingsToReinsert = 0;
+ QmlIR::Binding *tail = 0;
- Binding *previousBinding = 0;
- Binding *binding = object->firstBinding();
+ QmlIR::Binding *previousBinding = 0;
+ QmlIR::Binding *binding = object->firstBinding();
while (binding) {
if (binding->propertyNameIndex == 0 || stringAt(binding->propertyNameIndex) != defaultProperty) {
previousBinding = binding;
@@ -2452,7 +2452,7 @@ void QQmlDefaultPropertyMerger::mergeDefaultProperties(int objectIndex)
continue;
}
- Binding *toReinsert = binding;
+ QmlIR::Binding *toReinsert = binding;
binding = object->unlinkBinding(previousBinding, binding);
if (!tail) {
@@ -2467,7 +2467,7 @@ void QQmlDefaultPropertyMerger::mergeDefaultProperties(int objectIndex)
binding = bindingsToReinsert;
while (binding) {
- Binding *toReinsert = binding;
+ QmlIR::Binding *toReinsert = binding;
binding = binding->next;
object->insertSorted(toReinsert);
}
@@ -2494,13 +2494,13 @@ void QQmlJavaScriptBindingExpressionSimplificationPass::reduceTranslationBinding
void QQmlJavaScriptBindingExpressionSimplificationPass::reduceTranslationBindings(int objectIndex)
{
- const QmlObject *obj = qmlObjects.at(objectIndex);
+ const QmlIR::Object *obj = qmlObjects.at(objectIndex);
// Don't feed QV4::CompiledData::Binding::Type_Translation into custom parsers.
const bool allowTranslations = !customParsers.contains(obj->inheritedTypeNameIndex);
if (!allowTranslations)
return;
- for (Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
+ for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
if (binding->type != QV4::CompiledData::Binding::Type_Script)
continue;
@@ -2514,17 +2514,17 @@ void QQmlJavaScriptBindingExpressionSimplificationPass::reduceTranslationBinding
}
}
-void QQmlJavaScriptBindingExpressionSimplificationPass::visitMove(IR::Move *move)
+void QQmlJavaScriptBindingExpressionSimplificationPass::visitMove(QV4::IR::Move *move)
{
- IR::Temp *target = move->target->asTemp();
- if (!target || target->kind != IR::Temp::VirtualRegister) {
+ QV4::IR::Temp *target = move->target->asTemp();
+ if (!target || target->kind != QV4::IR::Temp::VirtualRegister) {
discard();
return;
}
- if (IR::Call *call = move->source->asCall()) {
- if (IR::Name *n = call->base->asName()) {
- if (n->builtin == IR::Name::builtin_invalid) {
+ if (QV4::IR::Call *call = move->source->asCall()) {
+ if (QV4::IR::Name *n = call->base->asName()) {
+ if (n->builtin == QV4::IR::Name::builtin_invalid) {
visitFunctionCall(n->id, call->args, target);
return;
}
@@ -2533,11 +2533,11 @@ void QQmlJavaScriptBindingExpressionSimplificationPass::visitMove(IR::Move *move
return;
}
- if (IR::Name *n = move->source->asName()) {
- if (n->builtin == IR::Name::builtin_qml_id_array
- || n->builtin == IR::Name::builtin_qml_imported_scripts_object
- || n->builtin == IR::Name::builtin_qml_context_object
- || n->builtin == IR::Name::builtin_qml_scope_object) {
+ if (QV4::IR::Name *n = move->source->asName()) {
+ if (n->builtin == QV4::IR::Name::builtin_qml_id_array
+ || n->builtin == QV4::IR::Name::builtin_qml_imported_scripts_object
+ || n->builtin == QV4::IR::Name::builtin_qml_context_object
+ || n->builtin == QV4::IR::Name::builtin_qml_scope_object) {
// these are free of side-effects
return;
}
@@ -2553,7 +2553,7 @@ void QQmlJavaScriptBindingExpressionSimplificationPass::visitMove(IR::Move *move
_temps[target->index] = move->source;
}
-void QQmlJavaScriptBindingExpressionSimplificationPass::visitFunctionCall(const QString *name, IR::ExprList *args, IR::Temp *target)
+void QQmlJavaScriptBindingExpressionSimplificationPass::visitFunctionCall(const QString *name, QV4::IR::ExprList *args, QV4::IR::Temp *target)
{
// more than one function call?
if (_nameOfFunctionCalled) {
@@ -2566,13 +2566,13 @@ void QQmlJavaScriptBindingExpressionSimplificationPass::visitFunctionCall(const
_functionParameters.clear();
while (args) {
int slot;
- if (IR::Temp *param = args->expr->asTemp()) {
- if (param->kind != IR::Temp::VirtualRegister) {
+ if (QV4::IR::Temp *param = args->expr->asTemp()) {
+ if (param->kind != QV4::IR::Temp::VirtualRegister) {
discard();
return;
}
slot = param->index;
- } else if (IR::Const *param = args->expr->asConst()) {
+ } else if (QV4::IR::Const *param = args->expr->asConst()) {
slot = --_synthesizedConsts;
Q_ASSERT(!_temps.contains(slot));
_temps[slot] = param;
@@ -2591,15 +2591,15 @@ void QQmlJavaScriptBindingExpressionSimplificationPass::visitRet(QV4::IR::Ret *r
discard();
return;
}
- IR::Temp *target = ret->expr->asTemp();
- if (!target || target->kind != IR::Temp::VirtualRegister) {
+ QV4::IR::Temp *target = ret->expr->asTemp();
+ if (!target || target->kind != QV4::IR::Temp::VirtualRegister) {
discard();
return;
}
_returnValueOfBindingExpression = target->index;
}
-bool QQmlJavaScriptBindingExpressionSimplificationPass::simplifyBinding(QV4::IR::Function *function, Binding *binding)
+bool QQmlJavaScriptBindingExpressionSimplificationPass::simplifyBinding(QV4::IR::Function *function, QmlIR::Binding *binding)
{
_canSimplify = true;
_nameOfFunctionCalled = 0;
@@ -2638,7 +2638,7 @@ bool QQmlJavaScriptBindingExpressionSimplificationPass::simplifyBinding(QV4::IR:
return false;
}
-bool QQmlJavaScriptBindingExpressionSimplificationPass::detectTranslationCallAndConvertBinding(Binding *binding)
+bool QQmlJavaScriptBindingExpressionSimplificationPass::detectTranslationCallAndConvertBinding(QmlIR::Binding *binding)
{
if (*_nameOfFunctionCalled == QStringLiteral("qsTr")) {
QString translation;
@@ -2651,7 +2651,7 @@ bool QQmlJavaScriptBindingExpressionSimplificationPass::detectTranslationCallAnd
if (param == end)
return false;
- IR::String *stringParam = _temps[*param]->asString();
+ QV4::IR::String *stringParam = _temps[*param]->asString();
if (!stringParam)
return false;
@@ -2666,8 +2666,8 @@ bool QQmlJavaScriptBindingExpressionSimplificationPass::detectTranslationCallAnd
++param;
if (param != end) {
- IR::Const *constParam = _temps[*param]->asConst();
- if (!constParam || constParam->type != IR::SInt32Type)
+ QV4::IR::Const *constParam = _temps[*param]->asConst();
+ if (!constParam || constParam->type != QV4::IR::SInt32Type)
return false;
translationData.number = int(constParam->value);
@@ -2693,7 +2693,7 @@ bool QQmlJavaScriptBindingExpressionSimplificationPass::detectTranslationCallAnd
if (param == end)
return false;
- IR::String *stringParam = _temps[*param]->asString();
+ QV4::IR::String *stringParam = _temps[*param]->asString();
if (!stringParam)
return false;
@@ -2701,8 +2701,8 @@ bool QQmlJavaScriptBindingExpressionSimplificationPass::detectTranslationCallAnd
++param;
if (param != end) {
- IR::Const *constParam = _temps[*param]->asConst();
- if (!constParam || constParam->type != IR::SInt32Type)
+ QV4::IR::Const *constParam = _temps[*param]->asConst();
+ if (!constParam || constParam->type != QV4::IR::SInt32Type)
return false;
translationData.number = int(constParam->value);
@@ -2745,15 +2745,15 @@ void QQmlIRFunctionCleanser::clean()
module->functions = newFunctions;
- foreach (IR::Function *function, module->functions) {
- foreach (IR::BasicBlock *block, function->basicBlocks) {
- foreach (IR::Stmt *s, block->statements) {
+ foreach (QV4::IR::Function *function, module->functions) {
+ foreach (QV4::IR::BasicBlock *block, function->basicBlocks) {
+ foreach (QV4::IR::Stmt *s, block->statements) {
s->accept(this);
}
}
}
- foreach (QmlObject *obj, *compiler->qmlObjects()) {
+ foreach (QmlIR::Object *obj, *compiler->qmlObjects()) {
if (!obj->runtimeFunctionIndices)
continue;
for (int i = 0; i < obj->runtimeFunctionIndices->count; ++i)
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h
index 74168fee41..09e30a40f7 100644
--- a/src/qml/compiler/qqmltypecompiler_p.h
+++ b/src/qml/compiler/qqmltypecompiler_p.h
@@ -54,7 +54,7 @@ class QQmlError;
class QQmlTypeData;
class QQmlImports;
-namespace QtQml {
+namespace QmlIR {
struct ParsedQML;
}
@@ -69,7 +69,7 @@ struct QQmlTypeCompiler
{
Q_DECLARE_TR_FUNCTIONS(QQmlTypeCompiler)
public:
- QQmlTypeCompiler(QQmlEnginePrivate *engine, QQmlCompiledData *compiledData, QQmlTypeData *typeData, QtQml::ParsedQML *parsedQML);
+ QQmlTypeCompiler(QQmlEnginePrivate *engine, QQmlCompiledData *compiledData, QQmlTypeData *typeData, QmlIR::ParsedQML *parsedQML);
bool compile();
@@ -87,7 +87,7 @@ public:
QQmlEnginePrivate *enginePrivate() const { return engine; }
const QQmlImports *imports() const;
QHash<int, QQmlCompiledData::TypeReference *> *resolvedTypes();
- QList<QtQml::QmlObject*> *qmlObjects();
+ QList<QmlIR::Object*> *qmlObjects();
int rootObjectIndex() const;
void setPropertyCaches(const QVector<QQmlPropertyCache *> &caches);
const QVector<QQmlPropertyCache *> &propertyCaches() const;
@@ -109,7 +109,7 @@ private:
QQmlEnginePrivate *engine;
QQmlCompiledData *compiledData;
QQmlTypeData *typeData;
- QtQml::ParsedQML *parsedQML;
+ QmlIR::ParsedQML *parsedQML;
// index is string index of type name (use obj->inheritedTypeNameIndex)
QHash<int, QQmlCustomParser*> customParsers;
};
@@ -138,10 +138,10 @@ public:
protected:
bool buildMetaObjectRecursively(int objectIndex, int referencingObjectIndex, const QV4::CompiledData::Binding *instantiatingBinding);
bool ensureMetaObject(int objectIndex);
- bool createMetaObject(int objectIndex, const QtQml::QmlObject *obj, QQmlPropertyCache *baseTypeCache);
+ bool createMetaObject(int objectIndex, const QmlIR::Object *obj, QQmlPropertyCache *baseTypeCache);
QQmlEnginePrivate *enginePrivate;
- const QList<QtQml::QmlObject*> &qmlObjects;
+ const QList<QmlIR::Object*> &qmlObjects;
const QQmlImports *imports;
QHash<int, QQmlCompiledData::TypeReference*> *resolvedTypes;
QVector<QByteArray> vmeMetaObjects;
@@ -161,9 +161,9 @@ public:
bool convertSignalHandlerExpressionsToFunctionDeclarations();
private:
- bool convertSignalHandlerExpressionsToFunctionDeclarations(const QmlObject *obj, const QString &typeName, QQmlPropertyCache *propertyCache);
+ bool convertSignalHandlerExpressionsToFunctionDeclarations(const QmlIR::Object *obj, const QString &typeName, QQmlPropertyCache *propertyCache);
- const QList<QtQml::QmlObject*> &qmlObjects;
+ const QList<QmlIR::Object*> &qmlObjects;
const QHash<int, QQmlCustomParser*> &customParsers;
const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes;
const QSet<QString> &illegalNames;
@@ -182,13 +182,13 @@ public:
bool resolveEnumBindings();
private:
- bool tryQualifiedEnumAssignment(const QmlObject *obj, const QQmlPropertyCache *propertyCache,
+ bool tryQualifiedEnumAssignment(const QmlIR::Object *obj, const QQmlPropertyCache *propertyCache,
const QQmlPropertyData *prop,
- QtQml::Binding *binding);
+ QmlIR::Binding *binding);
int evaluateEnum(const QString &scope, const QByteArray &enumValue, bool *ok) const;
- const QList<QtQml::QmlObject*> &qmlObjects;
+ const QList<QmlIR::Object*> &qmlObjects;
const QVector<QQmlPropertyCache *> propertyCaches;
const QQmlImports *imports;
QHash<int, QQmlCompiledData::TypeReference *> *resolvedTypes;
@@ -202,7 +202,7 @@ public:
void annotateBindingsToAliases();
private:
- const QList<QtQml::QmlObject*> &qmlObjects;
+ const QList<QmlIR::Object*> &qmlObjects;
const QVector<QQmlPropertyCache *> propertyCaches;
};
@@ -215,14 +215,14 @@ public:
bool resolve();
protected:
- void findAndRegisterImplicitComponents(const QtQml::QmlObject *obj, QQmlPropertyCache *propertyCache);
+ void findAndRegisterImplicitComponents(const QmlIR::Object *obj, QQmlPropertyCache *propertyCache);
bool collectIdsAndAliases(int objectIndex);
bool resolveAliases();
QQmlEnginePrivate *enginePrivate;
QQmlJS::MemoryPool *pool;
- QList<QtQml::QmlObject*> *qmlObjects;
+ QList<QmlIR::Object*> *qmlObjects;
const int indexOfRootObject;
// indices of the objects that are actually Component {}
@@ -282,7 +282,7 @@ private:
class QQmlJSCodeGenerator : public QQmlCompilePass
{
public:
- QQmlJSCodeGenerator(QQmlTypeCompiler *typeCompiler, QtQml::JSCodeGen *v4CodeGen);
+ QQmlJSCodeGenerator(QQmlTypeCompiler *typeCompiler, QmlIR::JSCodeGen *v4CodeGen);
bool generateCodeForComponents();
@@ -295,9 +295,9 @@ private:
const QHash<int, QHash<int, int> > &objectIndexToIdPerComponent;
const QHash<int, QQmlCompiledData::TypeReference*> &resolvedTypes;
const QHash<int, QQmlCustomParser*> &customParsers;
- const QList<QtQml::QmlObject*> &qmlObjects;
+ const QList<QmlIR::Object*> &qmlObjects;
const QVector<QQmlPropertyCache *> &propertyCaches;
- QtQml::JSCodeGen * const v4CodeGen;
+ QmlIR::JSCodeGen * const v4CodeGen;
};
class QQmlDefaultPropertyMerger : public QQmlCompilePass
@@ -310,7 +310,7 @@ public:
private:
void mergeDefaultProperties(int objectIndex);
- const QList<QtQml::QmlObject*> &qmlObjects;
+ const QList<QmlIR::Object*> &qmlObjects;
const QVector<QQmlPropertyCache*> &propertyCaches;
};
@@ -328,17 +328,17 @@ private:
virtual void visitJump(QV4::IR::Jump *) {}
virtual void visitCJump(QV4::IR::CJump *) { discard(); }
virtual void visitExp(QV4::IR::Exp *) { discard(); }
- virtual void visitPhi(IR::Phi *) {}
+ virtual void visitPhi(QV4::IR::Phi *) {}
virtual void visitRet(QV4::IR::Ret *ret);
- void visitFunctionCall(const QString *name, IR::ExprList *args, IR::Temp *target);
+ void visitFunctionCall(const QString *name, QV4::IR::ExprList *args, QV4::IR::Temp *target);
void discard() { _canSimplify = false; }
- bool simplifyBinding(QV4::IR::Function *function, Binding *binding);
- bool detectTranslationCallAndConvertBinding(Binding *binding);
+ bool simplifyBinding(QV4::IR::Function *function, QmlIR::Binding *binding);
+ bool detectTranslationCallAndConvertBinding(QmlIR::Binding *binding);
- const QList<QtQml::QmlObject*> &qmlObjects;
+ const QList<QmlIR::Object*> &qmlObjects;
const QHash<int, QQmlCustomParser*> &customParsers;
QV4::IR::Module *jsModule;
@@ -347,7 +347,7 @@ private:
QVector<int> _functionParameters;
int _functionCallReturnValue;
- QHash<int, IR::Expr*> _temps;
+ QHash<int, QV4::IR::Expr*> _temps;
int _returnValueOfBindingExpression;
int _synthesizedConsts;
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 295461ba26..306552d39c 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -215,7 +215,7 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags)
QV4::ScopedFunctionObject f(scope, v4function.value());
Q_ASSERT(f);
if (f->bindingKeyFlag) {
- QQmlSourceLocation loc = f->as<QQmlBindingFunction>()->bindingLocation;
+ QQmlSourceLocation loc = f->as<QV4::QQmlBindingFunction>()->bindingLocation;
url = loc.sourceFile;
lineNumber = loc.line;
columnNumber = loc.column;
diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp
index 16e3abf3a0..037b07dbb3 100644
--- a/src/qml/qml/qqmlcustomparser.cpp
+++ b/src/qml/qml/qqmlcustomparser.cpp
@@ -102,7 +102,7 @@ void QQmlCustomParser::clearErrors()
An error is generated referring to the \a location in the source file.
*/
-void QQmlCustomParser::error(const CompiledData::Location &location, const QString &description)
+void QQmlCustomParser::error(const QV4::CompiledData::Location &location, const QString &description)
{
QQmlError error;
error.setLine(location.line);
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 0825b8ec53..847d325763 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -703,7 +703,7 @@ void QQmlObjectCreator::setupBindings(const QBitArray &bindingsToSkip)
if (!name.isEmpty()) {
if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression
|| binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject)
- property = PropertyResolver(_propertyCache).signal(name, /*notInRevision*/0, _qobject, context);
+ property = QmlIR::PropertyResolver(_propertyCache).signal(name, /*notInRevision*/0, _qobject, context);
else
property = _propertyCache->property(name, _qobject, context);
} else
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 5c48304b56..6b01a64c40 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2133,8 +2133,8 @@ void QQmlTypeData::dataReceived(const Data &data)
if (data.isFile()) preparseData = data.asFile()->metaData(QLatin1String("qml:preparse"));
QQmlEngine *qmlEngine = typeLoader()->engine();
- parsedQML.reset(new QtQml::ParsedQML(QV8Engine::getV4(qmlEngine)->debugger != 0));
- QQmlCodeGenerator compiler(QV8Engine::get(qmlEngine)->illegalNames());
+ parsedQML.reset(new QmlIR::ParsedQML(QV8Engine::getV4(qmlEngine)->debugger != 0));
+ QmlIR::QQmlCodeGenerator compiler(QV8Engine::get(qmlEngine)->illegalNames());
if (!compiler.generateFromQml(code, finalUrl(), finalUrlString(), parsedQML.data())) {
setError(compiler.errors);
return;
@@ -2207,13 +2207,13 @@ void QQmlTypeData::dataReceived(const Data &data)
// ### convert to use new data structure once old compiler is gone.
if (m_newPragmas.isEmpty()) {
m_newPragmas.reserve(parsedQML->pragmas.size());
- foreach (QtQml::Pragma *p, parsedQML->pragmas) {
+ foreach (QmlIR::Pragma *p, parsedQML->pragmas) {
QQmlScript::Pragma pragma;
pragma.location.start.line = p->location.line;
pragma.location.start.column = p->location.column;
switch (p->type) {
- case QtQml::Pragma::PragmaSingleton: pragma.type = QQmlScript::Pragma::Singleton; break;
+ case QmlIR::Pragma::PragmaSingleton: pragma.type = QQmlScript::Pragma::Singleton; break;
default: break;
}
diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h
index 9cd28a03ce..adb998d1f8 100644
--- a/src/qml/qml/qqmltypeloader_p.h
+++ b/src/qml/qml/qqmltypeloader_p.h
@@ -84,7 +84,7 @@ class QQmlTypeData;
class QQmlDataLoader;
class QQmlExtensionInterface;
-namespace QtQml {
+namespace QmlIR {
struct ParsedQML;
}
@@ -455,7 +455,7 @@ private:
virtual void scriptImported(QQmlScriptBlob *blob, const QQmlScript::Location &location, const QString &qualifier, const QString &nameSpace);
- QScopedPointer<QtQml::ParsedQML> parsedQML;
+ QScopedPointer<QmlIR::ParsedQML> parsedQML;
QList<QQmlScript::Import> m_newImports;
QList<QQmlScript::Pragma> m_newPragmas;
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 085bf24430..67c7dfb5b2 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -2317,7 +2317,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o,
ctx->catchException();
return false;
}
- return Runtime::strictEqual(value, result);
+ return QV4::Runtime::strictEqual(value, result);
}
static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::ValueRef o,