aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmltypecompiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qqmltypecompiler.cpp')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp37
1 files changed, 12 insertions, 25 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index f5cb5db369..a4130cb45f 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -298,7 +298,7 @@ bool QQmlTypeCompiler::compile()
void QQmlTypeCompiler::recordError(const QQmlError &error)
{
QQmlError e = error;
- e.setUrl(compiledData->url);
+ e.setUrl(url());
errors << e;
}
@@ -378,9 +378,9 @@ QHash<int, QHash<int, int> > *QQmlTypeCompiler::objectIndexToIdPerComponent()
return &compiledData->objectIndexToIdPerComponent;
}
-QHash<int, QQmlCompiledData::CustomParserData> *QQmlTypeCompiler::customParserData()
+QHash<int, QBitArray> *QQmlTypeCompiler::customParserBindings()
{
- return &compiledData->customParserData;
+ return &compiledData->customParserBindings;
}
QQmlJS::MemoryPool *QQmlTypeCompiler::memoryPool()
@@ -398,11 +398,6 @@ const QV4::Compiler::StringTableGenerator *QQmlTypeCompiler::stringPool() const
return &document->jsGenerator.stringTable;
}
-void QQmlTypeCompiler::setCustomParserBindings(const QVector<int> &bindings)
-{
- compiledData->customParserBindings = bindings;
-}
-
void QQmlTypeCompiler::setDeferredBindingsPerObject(const QHash<int, QBitArray> &deferredBindingsPerObject)
{
compiledData->deferredBindingsPerObject = deferredBindingsPerObject;
@@ -1722,7 +1717,7 @@ QQmlPropertyValidator::QQmlPropertyValidator(QQmlTypeCompiler *typeCompiler)
, customParsers(typeCompiler->customParserCache())
, propertyCaches(typeCompiler->propertyCaches())
, objectIndexToIdPerComponent(*typeCompiler->objectIndexToIdPerComponent())
- , customParserData(typeCompiler->customParserData())
+ , customParserBindingsPerObject(typeCompiler->customParserBindings())
, _seenObjectWithId(false)
{
}
@@ -1731,7 +1726,6 @@ bool QQmlPropertyValidator::validate()
{
if (!validateObject(qmlUnit->indexOfRootObject, /*instantiatingBinding*/0))
return false;
- compiler->setCustomParserBindings(customParserBindings);
compiler->setDeferredBindingsPerObject(deferredBindingsPerObject);
return true;
}
@@ -1741,13 +1735,6 @@ const QQmlImports &QQmlPropertyValidator::imports() const
return *compiler->imports();
}
-QQmlBinding::Identifier QQmlPropertyValidator::bindingIdentifier(const QV4::CompiledData::Binding *binding, QQmlCustomParser *)
-{
- const int id = customParserBindings.count();
- customParserBindings.append(binding->value.compiledScriptIndex);
- return id;
-}
-
QString QQmlPropertyValidator::bindingAsString(int objectIndex, const QV4::CompiledData::Binding *binding) const
{
const QmlIR::Object *object = compiler->qmlObjects()->value(objectIndex);
@@ -2018,11 +2005,11 @@ bool QQmlPropertyValidator::validateObject(int objectIndex, const QV4::CompiledD
if (customParser && !customBindings.isEmpty()) {
customParser->clearErrors();
customParser->compiler = this;
- QQmlCompiledData::CustomParserData data;
- data.bindings = customParserBindings;
- data.compilationArtifact = customParser->compile(qmlUnit, customBindings);
+ customParser->imports = compiler->imports();
+ customParser->verifyBindings(qmlUnit, customBindings);
customParser->compiler = 0;
- customParserData->insert(objectIndex, data);
+ customParser->imports = (QQmlImports*)0;
+ customParserBindingsPerObject->insert(objectIndex, customParserBindings);
const QList<QQmlError> parserErrors = customParser->errors();
if (!parserErrors.isEmpty()) {
foreach (QQmlError error, parserErrors)
@@ -2168,7 +2155,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
#endif // QT_NO_DATESTRING
case QVariant::Point: {
bool ok = false;
- QQmlStringConverters::pointFFromString(binding->valueAsString(&qmlUnit->header), &ok).toPoint();
+ QQmlStringConverters::pointFFromString(binding->valueAsString(&qmlUnit->header), &ok);
if (!ok) {
recordError(binding->valueLocation, tr("Invalid property assignment: point expected"));
return false;
@@ -2186,7 +2173,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
break;
case QVariant::Size: {
bool ok = false;
- QQmlStringConverters::sizeFFromString(binding->valueAsString(&qmlUnit->header), &ok).toSize();
+ QQmlStringConverters::sizeFFromString(binding->valueAsString(&qmlUnit->header), &ok);
if (!ok) {
recordError(binding->valueLocation, tr("Invalid property assignment: size expected"));
return false;
@@ -2204,7 +2191,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
break;
case QVariant::Rect: {
bool ok = false;
- QQmlStringConverters::rectFFromString(binding->valueAsString(&qmlUnit->header), &ok).toRect();
+ QQmlStringConverters::rectFFromString(binding->valueAsString(&qmlUnit->header), &ok);
if (!ok) {
recordError(binding->valueLocation, tr("Invalid property assignment: rect expected"));
return false;
@@ -2259,7 +2246,7 @@ bool QQmlPropertyValidator::validateLiteralBinding(QQmlPropertyCache *propertyCa
// generate single literal value assignment to a list property if required
if (property->propType == qMetaTypeId<QList<qreal> >()) {
if (binding->type != QV4::CompiledData::Binding::Type_Number) {
- recordError(binding->valueLocation, tr("Invalid property assignment: real or array of reals expected"));
+ recordError(binding->valueLocation, tr("Invalid property assignment: number or array of numbers expected"));
return false;
}
break;