aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-06-04 17:32:31 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-05 10:01:44 +0200
commit8a71e2bd031230777dcfbb482af40a03b8d91507 (patch)
tree3a480949822d2bb15b5746decc3147e915397f6a /src/qml
parent722c06318718f373a581e74913965b5dfa3979fb (diff)
Cleanup: Get rid of the url and file name members in QQmlCompiledData
This is part of the effor of moving members from QQmlCompiledData into QV4::CompilationUnit in order to eliminate the former in the long run. Change-Id: Icce7fe0ee9a49cb3a7677fd7020008fc55ecdcf6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/compiler/qqmlirbuilder.cpp5
-rw-r--r--src/qml/compiler/qqmlirbuilder_p.h3
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp2
-rw-r--r--src/qml/compiler/qqmltypecompiler_p.h2
-rw-r--r--src/qml/qml/qqmlbinding.cpp2
-rw-r--r--src/qml/qml/qqmlcompiler_p.h4
-rw-r--r--src/qml/qml/qqmlcomponent.cpp2
-rw-r--r--src/qml/qml/qqmlexpression.cpp2
-rw-r--r--src/qml/qml/qqmlincubator.cpp4
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp12
-rw-r--r--src/qml/qml/qqmltypeloader.cpp6
11 files changed, 20 insertions, 24 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp
index 28a4e23a37..f02e92ceb2 100644
--- a/src/qml/compiler/qqmlirbuilder.cpp
+++ b/src/qml/compiler/qqmlirbuilder.cpp
@@ -558,9 +558,8 @@ IRBuilder::IRBuilder(const QSet<QString> &illegalNames)
{
}
-bool IRBuilder::generateFromQml(const QString &code, const QString &url, const QString &urlString, Document *output)
+bool IRBuilder::generateFromQml(const QString &code, const QString &url, Document *output)
{
- this->url = url;
QQmlJS::AST::UiProgram *program = 0;
{
QQmlJS::Lexer lexer(&output->jsParserEngine);
@@ -574,7 +573,7 @@ bool IRBuilder::generateFromQml(const QString &code, const QString &url, const Q
foreach (const QQmlJS::DiagnosticMessage &m, parser.diagnosticMessages()) {
if (m.isWarning()) {
- qWarning("%s:%d : %s", qPrintable(urlString), m.loc.startLine, qPrintable(m.message));
+ qWarning("%s:%d : %s", qPrintable(url), m.loc.startLine, qPrintable(m.message));
continue;
}
diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h
index 3438af425c..1aac878776 100644
--- a/src/qml/compiler/qqmlirbuilder_p.h
+++ b/src/qml/compiler/qqmlirbuilder_p.h
@@ -343,7 +343,7 @@ struct Q_QML_PRIVATE_EXPORT IRBuilder : public QQmlJS::AST::Visitor
Q_DECLARE_TR_FUNCTIONS(QQmlCodeGenerator)
public:
IRBuilder(const QSet<QString> &illegalNames);
- bool generateFromQml(const QString &code, const QString &url, const QString &urlString, Document *output);
+ bool generateFromQml(const QString &code, const QString &url, Document *output);
static bool isSignalPropertyName(const QString &name);
@@ -420,7 +420,6 @@ public:
QQmlJS::MemoryPool *pool;
QString sourceCode;
- QString url;
QV4::Compiler::JSUnitGenerator *jsGenerator;
};
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 3aad050dff..e1f68a6dac 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;
}
diff --git a/src/qml/compiler/qqmltypecompiler_p.h b/src/qml/compiler/qqmltypecompiler_p.h
index 3f311d8693..caf1f93923 100644
--- a/src/qml/compiler/qqmltypecompiler_p.h
+++ b/src/qml/compiler/qqmltypecompiler_p.h
@@ -84,7 +84,7 @@ public:
const QV4::CompiledData::QmlUnit *qmlUnit() const;
- QUrl url() const { return compiledData->url; }
+ QUrl url() const { return typeData->finalUrl(); }
QQmlEnginePrivate *enginePrivate() const { return engine; }
const QQmlImports *imports() const;
QHash<int, QQmlCompiledData::TypeReference *> *resolvedTypes();
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 074f568d09..68037c558b 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -106,7 +106,7 @@ QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlConte
Q_ASSERT(typeData);
if (QQmlCompiledData *cdata = typeData->compiledData()) {
- url = cdata->name;
+ url = cdata->fileName();
if (scriptPrivate->bindingId != QQmlBinding::Invalid)
runtimeFunction = cdata->compilationUnit->runtimeFunctions.at(scriptPrivate->bindingId);
}
diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h
index 9f0f80063b..129d312ad1 100644
--- a/src/qml/qml/qqmlcompiler_p.h
+++ b/src/qml/qml/qqmlcompiler_p.h
@@ -91,8 +91,8 @@ public:
QQmlEngine *engine;
- QString name;
- QUrl url;
+ QString fileName() const { return compilationUnit->fileName(); }
+ QUrl url() const { return QUrl(fileName()); }
QQmlTypeNameCache *importCache;
int metaTypeId;
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 39a7d8905d..c247c7f5a6 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -592,7 +592,7 @@ QQmlComponent::QQmlComponent(QQmlEngine *engine, QQmlCompiledData *cc, int start
d->cc = cc;
cc->addref();
d->start = start;
- d->url = cc->url;
+ d->url = cc->url();
d->progress = 1.0;
}
diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp
index 4dc3704bbb..e993ed98eb 100644
--- a/src/qml/qml/qqmlexpression.cpp
+++ b/src/qml/qml/qqmlexpression.cpp
@@ -161,7 +161,7 @@ QQmlExpression::QQmlExpression(const QQmlScriptString &script, QQmlContext *ctxt
Q_ASSERT(typeData);
if (QQmlCompiledData *cdata = typeData->compiledData()) {
- d->url = cdata->name;
+ d->url = cdata->fileName();
d->line = scriptPrivate->lineNumber;
d->column = scriptPrivate->columnNumber;
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp
index 4cdeb19719..0665a4ac1a 100644
--- a/src/qml/qml/qqmlincubator.cpp
+++ b/src/qml/qml/qqmlincubator.cpp
@@ -283,7 +283,7 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i)
if (!compiledData)
return;
- QML_MEMORY_SCOPE_URL(compiledData->url);
+ QML_MEMORY_SCOPE_URL(compiledData->url());
QExplicitlySharedDataPointer<QQmlIncubatorPrivate> protectThis(this);
@@ -297,7 +297,7 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i)
if (!guardOk) {
QQmlError error;
- error.setUrl(compiledData->url);
+ error.setUrl(compiledData->url());
error.setDescription(QQmlComponent::tr("Object destroyed during incubation"));
errors << error;
progress = QQmlIncubatorPrivate::Completed;
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 65e302d3d9..5eaea7d9f4 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -179,8 +179,8 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI
context = new QQmlContextData;
context->isInternal = true;
- context->url = compiledData->url;
- context->urlString = compiledData->name;
+ context->url = compiledData->url();
+ context->urlString = compiledData->fileName();
context->imports = compiledData->importCache;
context->imports->addref();
context->setParent(parentContext);
@@ -384,7 +384,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
QString string = binding->valueAsString(&qmlUnit->header);
// Encoded dir-separators defeat QUrl processing - decode them first
string.replace(QLatin1String("%2f"), QLatin1String("/"), Qt::CaseInsensitive);
- QUrl value = string.isEmpty() ? QUrl() : compiledData->url.resolved(QUrl(string));
+ QUrl value = string.isEmpty() ? QUrl() : compiledData->url().resolved(QUrl(string));
// Apply URL interceptor
if (engine->urlInterceptor())
value = engine->urlInterceptor()->intercept(value, QQmlAbstractUrlInterceptor::UrlString);
@@ -579,7 +579,7 @@ void QQmlObjectCreator::setPropertyValue(QQmlPropertyData *property, const QV4::
} else if (property->propType == qMetaTypeId<QList<QUrl> >()) {
Q_ASSERT(binding->type == QV4::CompiledData::Binding::Type_String);
QString urlString = binding->valueAsString(&qmlUnit->header);
- QUrl u = urlString.isEmpty() ? QUrl() : compiledData->url.resolved(QUrl(urlString));
+ QUrl u = urlString.isEmpty() ? QUrl() : compiledData->url().resolved(QUrl(urlString));
QList<QUrl> value;
value.append(u);
argv[0] = reinterpret_cast<void *>(&value);
@@ -1006,7 +1006,7 @@ void QQmlObjectCreator::setupFunctions()
void QQmlObjectCreator::recordError(const QV4::CompiledData::Location &location, const QString &description)
{
QQmlError error;
- error.setUrl(compiledData->url);
+ error.setUrl(compiledData->url());
error.setLine(location.line);
error.setColumn(location.column);
error.setDescription(description);
@@ -1063,7 +1063,7 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
sharedState->allCreatedObjects.push(instance);
} else {
Q_ASSERT(typeRef->component);
- Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(typeRef->component->name,
+ Q_QML_OC_PROFILE(sharedState->profiler, profiler.update(typeRef->component->fileName(),
context->url, obj->location.line, obj->location.column));
if (typeRef->component->qmlUnit->isSingleton())
{
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 7fc08bd114..1afc5bbb8c 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2207,7 +2207,7 @@ void QQmlTypeData::dataReceived(const Data &data)
QQmlEngine *qmlEngine = typeLoader()->engine();
m_document.reset(new QmlIR::Document(QV8Engine::getV4(qmlEngine)->debugger != 0));
QmlIR::IRBuilder compiler(QV8Engine::get(qmlEngine)->illegalNames());
- if (!compiler.generateFromQml(code, finalUrlString(), finalUrlString(), m_document.data())) {
+ if (!compiler.generateFromQml(code, finalUrlString(), m_document.data())) {
QList<QQmlError> errors;
foreach (const QQmlJS::DiagnosticMessage &msg, compiler.errors) {
QQmlError e;
@@ -2332,10 +2332,8 @@ void QQmlTypeData::compile()
Q_ASSERT(m_compiledData == 0);
m_compiledData = new QQmlCompiledData(typeLoader()->engine());
- m_compiledData->url = finalUrl();
- m_compiledData->name = finalUrlString();
- QQmlCompilingProfiler prof(QQmlEnginePrivate::get(typeLoader()->engine())->profiler, m_compiledData->name);
+ QQmlCompilingProfiler prof(QQmlEnginePrivate::get(typeLoader()->engine())->profiler, finalUrlString());
QQmlTypeCompiler compiler(QQmlEnginePrivate::get(typeLoader()->engine()), m_compiledData, this, m_document.data());
if (!compiler.compile()) {