aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser/qqmljsast.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-08-30 12:58:55 +0200
committerLars Knoll <lars.knoll@qt.io>2018-08-31 06:08:41 +0000
commitee565b3db656b5b9bfd57d98d53b898c1a62e1f0 (patch)
tree857b0f3c09144e68ee0d6cfdf25a227df2f76c8b /src/qml/parser/qqmljsast.cpp
parentebf9365b5c7ec1e4828be88beeb930b4de52f35b (diff)
Correctly create methods for functions in object literals
Methods behave slightly different than normal functions as they have a home object and define how super property access is being done. To implement this correctly, we need to create these methods during object initialization time. Change-Id: Ib3f670c8790b882c6472de786938ca4f0b73f66f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsast.cpp')
-rw-r--r--src/qml/parser/qqmljsast.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp
index 9484b53a39..4ebb2d3b5c 100644
--- a/src/qml/parser/qqmljsast.cpp
+++ b/src/qml/parser/qqmljsast.cpp
@@ -465,6 +465,8 @@ bool PatternProperty::convertLiteralToAssignmentPattern(MemoryPool *pool, Source
*errorMessage = QString::fromLatin1("Invalid getter/setter in destructuring expression.");
return false;
}
+ if (type == Method)
+ type = Literal;
Q_ASSERT(type == Literal);
return PatternElement::convertLiteralToAssignmentPattern(pool, errorLocation, errorMessage);
}