diff options
Diffstat (limited to 'src/qml/parser')
-rw-r--r-- | src/qml/parser/qqmljsast.cpp | 11 | ||||
-rw-r--r-- | src/qml/parser/qqmljsast_p.h | 13 |
2 files changed, 19 insertions, 5 deletions
diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp index 7309cf8162..4b5d866662 100644 --- a/src/qml/parser/qqmljsast.cpp +++ b/src/qml/parser/qqmljsast.cpp @@ -1009,7 +1009,13 @@ BoundNames FormalParameterList::formals() const // change the name of the earlier argument to enforce the lookup semantics from the spec formals[duplicateIndex].id += QLatin1String("#") + QString::number(i); } - formals += {name, it->element->typeAnnotation}; + formals += { + name, + it->element->typeAnnotation, + it->element->isInjectedSignalParameter + ? BoundName::Injected + : BoundName::Declared + }; } ++i; } @@ -1412,7 +1418,8 @@ void PatternElement::boundNames(BoundNames *names) else if (PatternPropertyList *p = propertyList()) p->boundNames(names); } else { - names->append({bindingIdentifier.toString(), typeAnnotation}); + names->append({bindingIdentifier.toString(), typeAnnotation, + isInjectedSignalParameter ? BoundName::Injected : BoundName::Declared}); } } diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index f846a5a3dc..cb6d5fa3ee 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -887,13 +887,19 @@ public: struct QML_PARSER_EXPORT BoundName { + enum Type { + Declared, + Injected, + }; + QString id; - TypeAnnotation *typeAnnotation = nullptr; - BoundName(const QString &id, TypeAnnotation *typeAnnotation) - : id(id), typeAnnotation(typeAnnotation) + QTaggedPointer<TypeAnnotation, Type> typeAnnotation; + BoundName(const QString &id, TypeAnnotation *typeAnnotation, Type type = Declared) + : id(id), typeAnnotation(typeAnnotation, type) {} BoundName() = default; QString typeName() const { return typeAnnotation ? typeAnnotation->type->toString() : QString(); } + bool isInjected() const { return typeAnnotation.tag() == Injected; } }; struct BoundNames : public QVector<BoundName> @@ -981,6 +987,7 @@ public: // when used in a VariableDeclarationList VariableScope scope = VariableScope::NoScope; bool isForDeclaration = false; + bool isInjectedSignalParameter = false; }; class QML_PARSER_EXPORT PatternElementList : public Node |