diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-04-07 12:49:19 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-04-08 01:37:00 +0200 |
commit | d375273ba0d6fed567a5b8cc386395b10f5f2bda (patch) | |
tree | c82fa3b673d113dbe66206d91935b58026f62986 | |
parent | 48b8b67e8c2d756c38513a9ec39b16500ee1706c (diff) |
shiboken6: Enable adding modifications to declare-function
Amends 40483a4249306b62029987d03e7de57d456954b2.
Pick-to: 6.2
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>
-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 9ab7118cc..b6ff7f014 100644 --- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp +++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp @@ -935,7 +935,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; @@ -2250,10 +2251,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 e37d04718..2ee3c2ddf 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. @@ -313,7 +314,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 7de7abeb7..1e882f9c7 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. |