Improve type interference for QObject properties
authorSimon Hausmann <simon.hausmann@digia.com>
Wed, 30 Oct 2013 15:49:32 +0000 (16:49 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 25 Nov 2013 21:04:42 +0000 (22:04 +0100)
commitcf5185d1872f75b82876dd4e4ecdc3d27240f942
tree9c8bbf9597bfa38a4b56d4b6557797a7b2def501
parent222e06bf4ed509e72c1533cbe1d4859ca96933f3
Improve type interference for QObject properties

Propagate QObject properties in member expressions across temporaries
as part of the type interference SSA pass. This replaces the earlier
attempt to resolving QObject properties in fieldMemberExpression()
in the codegen, but it was incomplete and now things like the following
are fully resolved:

    var tmp = blah.somePropertyThatReturnsAQQuickItem; <-- QQuickItem property return type propagated into tmp
    var width = tmp.width; <-- and picked up here again to resolve the index of width instead of by name

With this patch Temp gets a helper structure with a function pointer,
initialized to aid the resolution of properties in Qt meta objects. This
structure is propagated into the temps until it reaches the next member
expression that uses the temp. Similarly QObjectType is added as IR type, next
to VarType.

The resolution inside the SSA type interference pass also requires passing
through the QQmlEngine from the upper caller levels, in order to resolve the
property type to a potential QMetaObject property.

Change-Id: I14c98fa455db57603da46613ce49c174d0944291
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
18 files changed:
src/qml/compiler/qqmlcodegenerator.cpp
src/qml/compiler/qqmlcodegenerator_p.h
src/qml/compiler/qv4codegen_p.h
src/qml/compiler/qv4isel_masm.cpp
src/qml/compiler/qv4isel_masm_p.h
src/qml/compiler/qv4isel_moth.cpp
src/qml/compiler/qv4isel_moth_p.h
src/qml/compiler/qv4isel_p.h
src/qml/compiler/qv4jsir.cpp
src/qml/compiler/qv4jsir_p.h
src/qml/compiler/qv4regalloc.cpp
src/qml/compiler/qv4ssa.cpp
src/qml/compiler/qv4ssa_p.h
src/qml/jsruntime/qv4functionobject.cpp
src/qml/jsruntime/qv4script.cpp
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlengine_p.h
src/qml/qml/qqmltypeloader.cpp