diff options
author | Sami Shalayel <sami.shalayel@qt.io> | 2023-06-02 09:41:14 +0200 |
---|---|---|
committer | Sami Shalayel <sami.shalayel@qt.io> | 2023-06-05 15:27:52 +0200 |
commit | 6d58a20fbbb2be7afa5a07963c786335df178103 (patch) | |
tree | 9298d0d49ff2b0d477e805572b903739d1216780 /src/qml/parser/qqmljsast_p.h | |
parent | 4fdaf22a54343f3f1185362db112cc44fd7d34b6 (diff) |
qmlls: find definitions of function parameters
Function parameter definitions in the QQmlJSScope were lacking their
source location, such that asking the definition of a parameter always
returned the location of the first parameter.
Fix it by writing the proper Location in the QQmlJSScope. This requires
adding the location information to BoundName(s).
Also added some tests.
Task-number: QTBUG-111409
Change-Id: Ieb6155f120ca24e899af4b3824cab561788d008b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Diffstat (limited to 'src/qml/parser/qqmljsast_p.h')
-rw-r--r-- | src/qml/parser/qqmljsast_p.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index 0511d8db91..5f718c4c62 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -844,9 +844,11 @@ struct QML_PARSER_EXPORT BoundName }; QString id; + QQmlJS::SourceLocation location; QTaggedPointer<TypeAnnotation, Type> typeAnnotation; - BoundName(const QString &id, TypeAnnotation *typeAnnotation, Type type = Declared) - : id(id), typeAnnotation(typeAnnotation, type) + BoundName(const QString &id, const QQmlJS::SourceLocation &location, + TypeAnnotation *typeAnnotation, Type type = Declared) + : id(id), location(location), typeAnnotation(typeAnnotation, type) {} BoundName() = default; |