diff mbox series

[RFC,16/32] qapi: Factor out _make_implicit_wrapper_type()

Message ID 20171002152552.27999-17-armbru@redhat.com
State New
Headers show
Series Command line QAPIfication | expand

Commit Message

Markus Armbruster Oct. 2, 2017, 3:25 p.m. UTC
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 scripts/qapi.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Marc-André Lureau Oct. 4, 2017, noon UTC | #1
On Mon, Oct 2, 2017 at 5:25 PM, Markus Armbruster <armbru@redhat.com> wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  scripts/qapi.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/qapi.py b/scripts/qapi.py
> index 248d650858..4871eb7740 100644
> --- a/scripts/qapi.py
> +++ b/scripts/qapi.py
> @@ -1552,6 +1552,11 @@ class QAPISchema(object):
>                                                    members, None))
>          return name
>
> +    def _make_implicit_wrapper_type(self, typ, info):
> +        return self._make_implicit_object_type(
> +            typ, info, None, 'wrapper',
> +            [self._make_member('data', typ, info)])
> +
>      def _def_enum_type(self, expr, info, doc):
>          name = expr['enum']
>          data = expr['data']
> @@ -1588,8 +1593,7 @@ class QAPISchema(object):
>          if isinstance(typ, list):
>              assert len(typ) == 1
>              typ = self._make_array_type(typ[0], info)
> -        typ = self._make_implicit_object_type(
> -            typ, info, None, 'wrapper', [self._make_member('data', typ, info)])
> +        typ = self._make_implicit_wrapper_type(typ, info)
>          return QAPISchemaObjectTypeVariant(case, typ)
>
>      def _def_union_type(self, expr, info, doc):
> --
> 2.13.6
>
>
diff mbox series

Patch

diff --git a/scripts/qapi.py b/scripts/qapi.py
index 248d650858..4871eb7740 100644
--- a/scripts/qapi.py
+++ b/scripts/qapi.py
@@ -1552,6 +1552,11 @@  class QAPISchema(object):
                                                   members, None))
         return name
 
+    def _make_implicit_wrapper_type(self, typ, info):
+        return self._make_implicit_object_type(
+            typ, info, None, 'wrapper',
+            [self._make_member('data', typ, info)])
+
     def _def_enum_type(self, expr, info, doc):
         name = expr['enum']
         data = expr['data']
@@ -1588,8 +1593,7 @@  class QAPISchema(object):
         if isinstance(typ, list):
             assert len(typ) == 1
             typ = self._make_array_type(typ[0], info)
-        typ = self._make_implicit_object_type(
-            typ, info, None, 'wrapper', [self._make_member('data', typ, info)])
+        typ = self._make_implicit_wrapper_type(typ, info)
         return QAPISchemaObjectTypeVariant(case, typ)
 
     def _def_union_type(self, expr, info, doc):