Fix use of function expressions with signal handlers
authorSimon Hausmann <simon.hausmann@theqtcompany.com>
Sun, 16 Aug 2015 13:26:40 +0000 (15:26 +0200)
committerSimon Hausmann <simon.hausmann@theqtcompany.com>
Mon, 24 Aug 2015 08:12:47 +0000 (08:12 +0000)
commitc907eb1b5bfc22ffcee1cc37ecfa762d7a3edd0a
treeb35cdebde92a7a8e32a6b62e94fa722142227131
parent45ea8df187d5dbe2776d793752d1eb3bf34b8fb3
Fix use of function expressions with signal handlers

Writing

    onClicked: function(mouseEvent) { ... }

would get silently "accepted" by the engine, but it wouldn't do anything. We
basically wrapped it in a new function, so that it became

    onClicked: function(mouse){ function(mouseEvent() {} }

which is a noop. With older versions this used to produce a syntax error.
However the better fix is to simply support this kind of assignment for more
expressive signal handlers, because now the names of the signal parameters can
be explicitly named (with names of your choice).

Change-Id: I96369f8805fab97509784222f614ee17cf681aba
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Michael Brasser <michael.brasser@live.com>
src/qml/compiler/qqmltypecompiler.cpp
tests/auto/qml/qqmllanguage/data/assignSignalFunctionExpression.qml [new file with mode: 0644]
tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp