aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qqmlcodegenerator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <[email protected]>2013-10-28 17:02:54 +0100
committerThe Qt Project <[email protected]>2013-10-31 18:55:14 +0100
commitf0ad3a5943804e9eb8e03434a4584eaafa5c5aea (patch)
tree8d2cb4402d63ced4e89c6c610fc839e0260d8e92 /src/qml/compiler/qqmlcodegenerator.cpp
parentb0afac3daf1cbb9daacbeac0183ef6254de6cc95 (diff)
Implement loading of resolved imported scripts
We can resolve the use of names that refer to imported scripts at compile time and load them at run-time by index through context->importedScripts. Change-Id: I681b19e7d68dbf3b9a68af00b4cea2a9254c2d78 Reviewed-by: Lars Knoll <[email protected]>
Diffstat (limited to 'src/qml/compiler/qqmlcodegenerator.cpp')
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 5fefa61a7a..40e64205ae 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -1324,11 +1324,11 @@ V4IR::Expr *JSCodeGen::member(V4IR::Expr *base, const QString *name)
// Check if it's suitable for caching
if (propertySuitable)
cache = engine->propertyCacheForType(baseAsMember->property->propType);
- } else if (baseAsMember->type == V4IR::Member::MemberByObjectId) {
+ } else if (baseAsMember->type == V4IR::Member::MemberOfQmlContext) {
// Similarly, properties of an id referenced object also don't need to be final, because
// we intend to find the version of a property available at compile time, not at run-time.
foreach (const IdMapping &mapping, _idObjects) {
- if (baseAsMember->objectId == mapping.idIndex) {
+ if (baseAsMember->memberIndex == mapping.idIndex) {
cache = mapping.type;
break;
}
@@ -1363,15 +1363,21 @@ V4IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col
// Look for IDs first.
foreach (const IdMapping &mapping, _idObjects)
if (name == mapping.name) {
- result = _block->QML_CONTEXT_ID_MEMBER(_block->NAME(V4IR::Name::builtin_qml_id_scope, line, col),
+ result = _block->QML_CONTEXT_MEMBER(_block->NAME(V4IR::Name::builtin_qml_id_scope, line, col),
_function->newString(mapping.name), mapping.idIndex);
break;
}
if (!result) {
QQmlTypeNameCache::Result r = imports->query(name);
- if (r.isValid())
- return 0; // TODO: We can't do fast lookup for these yet.
+ if (r.isValid()) {
+ if (r.scriptIndex != -1) {
+ result = _block->QML_CONTEXT_MEMBER(_block->NAME(V4IR::Name::builtin_qml_imported_scripts_scope, line, col),
+ _function->newString(name), r.scriptIndex);
+ } else {
+ return 0; // TODO: We can't do fast lookup for these yet.
+ }
+ }
}
if (!result && _scopeObject) {