diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2019-01-22 16:03:28 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2019-07-09 16:52:31 +0200 |
commit | 2377a02afe8d8b4237b703e88ef3423242ec7cf8 (patch) | |
tree | 3a091f50f80612ae3c25fcacc2edef6df0bbf34a /src/qml/parser | |
parent | 1b866db65eb45ff347b51a2bc3b08d2a0bc166d6 (diff) |
Collect type information for function parameters
Change-Id: Ia9ba819ce77eee7e582cf90aacf5baa4813d9fca
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/parser')
-rw-r--r-- | src/qml/parser/qqmljsast.cpp | 8 | ||||
-rw-r--r-- | src/qml/parser/qqmljsast_p.h | 7 |
2 files changed, 10 insertions, 5 deletions
diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp index f68381ce44..4f70bf0004 100644 --- a/src/qml/parser/qqmljsast.cpp +++ b/src/qml/parser/qqmljsast.cpp @@ -984,9 +984,9 @@ FunctionExpression *FunctionExpression::asFunctionDefinition() return this; } -QStringList FormalParameterList::formals() const +BoundNames FormalParameterList::formals() const { - QStringList formals; + BoundNames formals; int i = 0; for (const FormalParameterList *it = this; it; it = it->next) { if (it->element) { @@ -994,9 +994,9 @@ QStringList FormalParameterList::formals() const int duplicateIndex = formals.indexOf(name); if (duplicateIndex >= 0) { // change the name of the earlier argument to enforce the lookup semantics from the spec - formals[duplicateIndex] += QLatin1String("#") + QString::number(i); + formals[duplicateIndex].id += QLatin1String("#") + QString::number(i); } - formals += name; + formals += {name, it->element->typeAnnotation}; } ++i; } diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index cdee4843b0..da8d0bcd8d 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -850,6 +850,11 @@ struct BoundNames : public QVector<BoundName> return -1; return found - constBegin(); } + + bool contains(const QString &name) const + { + return indexOf(name) != -1; + } }; class QML_PARSER_EXPORT PatternElement : public Node @@ -2410,7 +2415,7 @@ public: return false; } - QStringList formals() const; + BoundNames formals() const; BoundNames boundNames() const; |