diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-04-07 12:49:19 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-04-08 03:08:52 +0000 |
commit | 989bbd947173c1bf2d76cbc69e20cf3e462c537d (patch) | |
tree | af285d53d209b1f895f4e493821f5290d0e42582 | |
parent | e3bc0369480347d62c8bb274130daa0ee7f4e880 (diff) |
shiboken6: Enable adding modifications to declare-function
Amends 40483a4249306b62029987d03e7de57d456954b2.
Task-number: PYSIDE-1627
Change-Id: I1521e7436749fb95f282a07539310257dca3918f
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit d375273ba0d6fed567a5b8cc386395b10f5f2bda)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/shiboken6/ApiExtractor/typesystemparser.cpp | 12 | ||||
-rw-r--r-- | sources/shiboken6/doc/typesystem_manipulating_objects.rst | 3 | ||||
-rw-r--r-- | sources/shiboken6/doc/typesystem_modify_function.rst | 3 |
3 files changed, 11 insertions, 7 deletions
diff --git a/sources/shiboken6/ApiExtractor/typesystemparser.cpp b/sources/shiboken6/ApiExtractor/typesystemparser.cpp index a4ad9ea7a..2db8300ba 100644 --- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp +++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp @@ -920,7 +920,8 @@ bool TypeSystemParser::endElement(StackElement element) } break; - case StackElement::AddFunction: { + case StackElement::AddFunction: + case StackElement::DeclareFunction: { // Leaving add-function: Assign all modifications to the added function const int modIndex = top->addedFunctionModificationIndex; top->addedFunctionModificationIndex = -1; @@ -2221,10 +2222,11 @@ bool TypeSystemParser::parseModifyArgument(const ConditionalStreamReader &, StackElement topElement, QXmlStreamAttributes *attributes) { if (topElement != StackElement::ModifyFunction - && topElement != StackElement::AddFunction) { - m_error = QString::fromLatin1("argument modification requires function" - " modification as parent, was %1") - .arg(tagFromElement(topElement)); + && topElement != StackElement::AddFunction + && topElement != StackElement::DeclareFunction) { + m_error = u"Argument modification requires <modify-function>," + " <add-function> or <declare-function> as parent, was "_qs + + tagFromElement(topElement).toString(); return false; } diff --git a/sources/shiboken6/doc/typesystem_manipulating_objects.rst b/sources/shiboken6/doc/typesystem_manipulating_objects.rst index 79add6d57..653de7718 100644 --- a/sources/shiboken6/doc/typesystem_manipulating_objects.rst +++ b/sources/shiboken6/doc/typesystem_manipulating_objects.rst @@ -261,6 +261,7 @@ add-function language, and it is a child of an :ref:`object-type` or :ref:`value-type` nodes if the function is supposed to be a method, or :ref:`namespace` and :ref:`typesystem` if the function is supposed to be a function inside a namespace or a global function. + It may contain :ref:`modify-argument` nodes. Typically when adding a function some code must be injected to provide the function logic. This can be done using the :ref:`inject-code` node. @@ -303,7 +304,7 @@ declare-function the type and it is a child of an :ref:`object-type` or :ref:`value-type` nodes if the function is supposed to be a method, or :ref:`namespace` and :ref:`typesystem` if the function is supposed to be a function inside a - namespace or a global function. + namespace or a global function. It may contain :ref:`modify-argument` nodes. .. code-block:: xml diff --git a/sources/shiboken6/doc/typesystem_modify_function.rst b/sources/shiboken6/doc/typesystem_modify_function.rst index d7cb50dd6..19d0f211a 100644 --- a/sources/shiboken6/doc/typesystem_modify_function.rst +++ b/sources/shiboken6/doc/typesystem_modify_function.rst @@ -9,7 +9,8 @@ modify-argument ^^^^^^^^^^^^^^^ Function modifications consist of a list of ``modify-argument`` nodes - contained in a :ref:`modify-function` node. Use the :ref:`remove-argument`, + contained in :ref:`modify-function`, :ref:`add-function` or + :ref:`declare-function` nodes. Use the :ref:`remove-argument`, :ref:`replace-default-expression`, :ref:`remove-default-expression`, :ref:`replace-type`, :ref:`reference-count` and :ref:`define-ownership` nodes to specify the details of the modification. |