Fix accelerated property lookup on id addressed objects
authorSimon Hausmann <simon.hausmann@digia.com>
Sun, 17 Nov 2013 17:17:28 +0000 (18:17 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 29 Nov 2013 07:19:55 +0000 (08:19 +0100)
For properties on id referenced objects, we can ignore the lack of the FINAL
keyword on properties, as we want the same "lexical" lookup rules like for
properties on the scope or context objects. In addition we need to initialize
the resolver on the returned temp, to ensure a successful type determination in
the use of the id object afterwards.

Change-Id: I496c942ade55aa331e6972f06b21c2c86d4b00a4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
src/qml/compiler/qqmlcodegenerator.cpp

index 974de72..1500480 100644 (file)
@@ -1552,9 +1552,10 @@ V4IR::Expr *JSCodeGen::fallbackNameLookup(const QString &name, int line, int col
             _function->idObjectDependencies.insert(mapping.idIndex);
             V4IR::Expr *s = subscript(_block->TEMP(_idArrayTemp), _block->CONST(V4IR::SInt32Type, mapping.idIndex));
             V4IR::Temp *result = _block->TEMP(_block->newTemp());
-            initMetaObjectResolver(&result->memberResolver, mapping.type);
             _block->MOVE(result, s);
             result = _block->TEMP(result->index);
+            initMetaObjectResolver(&result->memberResolver, mapping.type);
+            result->memberResolver.flags |= AllPropertiesAreFinal;
             result->isReadOnly = true; // don't allow use as lvalue
             return result;
         }