aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-12-12 16:23:14 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-09 10:33:00 +0100
commit36a4cc1830d4179f327e3b5700794514f3f56e06 (patch)
tree2534ff7bfef062fd0e7fce48a5cd987a23c9222b /src/qml/compiler
parente2c2fcd1d18990d7d1b7286fc8f2b9f8269691e2 (diff)
[new compiler] Move component determination and alias resolving
Move the code before the JS code generation, as we are going to need the component boundaries for the correct scoping. This requires the component and alias resolver to operate on the pre-compiled-data data structures. Change-Id: I8d2e697d8a05e5a4914db93e785704f6b2434a2e Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/compiler')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 7ff5570f14..96b69d02e5 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -151,6 +151,18 @@ bool QQmlTypeCompiler::compile()
compiledData->scripts << scriptData;
}
+ // Resolve component boundaries and aliases
+
+ {
+ // Scan for components, determine their scopes and resolve aliases within the scope.
+ QQmlComponentAndAliasResolver resolver(compiledData->url, parsedQML->jsGenerator.strings, parsedQML->objects, parsedQML->indexOfRootObject, compiledData->resolvedTypes, compiledData->propertyCaches,
+ &compiledData->datas, &compiledData->objectIndexToIdForRoot, &compiledData->objectIndexToIdPerComponent);
+ if (!resolver.resolve()) {
+ errors << resolver.errors;
+ return false;
+ }
+ }
+
// Compile JS binding expressions and signal handlers
JSCodeGen jsCodeGen(typeData->finalUrlString(), parsedQML->code, &parsedQML->jsModule, &parsedQML->jsParserEngine, parsedQML->program, compiledData->importCache);
@@ -178,18 +190,6 @@ bool QQmlTypeCompiler::compile()
compiledData->compilationUnit->ref();
compiledData->qmlUnit = qmlUnit; // ownership transferred to m_compiledData
- // Resolve component boundaries and aliases
-
- {
- // Scan for components, determine their scopes and resolve aliases within the scope.
- QQmlComponentAndAliasResolver resolver(compiledData->url, compiledData->qmlUnit, compiledData->resolvedTypes, compiledData->propertyCaches,
- &compiledData->datas, &compiledData->objectIndexToIdForRoot, &compiledData->objectIndexToIdPerComponent);
- if (!resolver.resolve()) {
- errors << resolver.errors;
- return false;
- }
- }
-
// Add to type registry of composites
if (compiledData->isCompositeType())
engine->registerInternalCompositeType(compiledData);