]> Git Repo - qemu.git/commitdiff
qapi: Fix errors for non-string, non-dictionary members
authorMarkus Armbruster <[email protected]>
Mon, 31 Aug 2015 15:28:52 +0000 (17:28 +0200)
committerMarkus Armbruster <[email protected]>
Fri, 4 Sep 2015 13:47:16 +0000 (15:47 +0200)
Fixes the errors demonstrated by the previous commit.

Signed-off-by: Markus Armbruster <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
scripts/qapi.py
tests/qapi-schema/args-invalid.err
tests/qapi-schema/args-invalid.json
tests/qapi-schema/struct-data-invalid.err
tests/qapi-schema/struct-data-invalid.json
tests/qapi-schema/struct-member-invalid.err
tests/qapi-schema/struct-member-invalid.json

index 197db77a9fd81e8d56d5433eaa9e311a3fbe4900..36560590ba0324723c357f8d3b9e76c771a0b507 100644 (file)
@@ -462,13 +462,15 @@ def check_type(expr_info, source, value, allow_array = False,
                                 % (source, all_names[value], orig_value))
         return
 
-    # value is a dictionary, check that each member is okay
-    if not isinstance(value, OrderedDict):
-        raise QAPIExprError(expr_info,
-                            "%s should be a dictionary" % source)
     if not allow_dict:
         raise QAPIExprError(expr_info,
                             "%s should be a type name" % source)
+
+    if not isinstance(value, OrderedDict):
+        raise QAPIExprError(expr_info,
+                            "%s should be a dictionary or type name" % source)
+
+    # value is a dictionary, check that each member is okay
     for (key, arg) in value.items():
         check_name(expr_info, "Member of %s" % source, key,
                    allow_optional=allow_optional)
index 6d0fa05c803fb51e8c18fd9154b07420a283557f..fe1e94975b9401a16d734c8ead0bf4acb8803a77 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/args-invalid.json:2: 'data' for command 'foo' should be a dictionary
+tests/qapi-schema/args-invalid.json:1: 'data' for command 'foo' should be a dictionary or type name
index 4a641350e3e23853d0f7912f3ed93d8b8bbe3a00..db0981341b8d643f7c064769c6a5f0ce72e58431 100644 (file)
@@ -1,3 +1,2 @@
-# FIXME error "should be a dictionary" is misleading, type name is also fine
 { 'command': 'foo',
   'data': false }
index a40e23aaeae0fbe1b2080ba465543a6570cfcee7..6644f4c2ad2f88738a57664fd3b5c90dfe1566c3 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/struct-data-invalid.json:2: 'data' for struct 'foo' should be a dictionary
+tests/qapi-schema/struct-data-invalid.json:1: 'data' for struct 'foo' should be a dictionary or type name
index b76de82552c060b9c019dbd613280240ee81a532..9adbc3bb6b63912e3d684c017be0f59950f8a765 100644 (file)
@@ -1,3 +1,2 @@
-# FIXME error "should be a dictionary" is misleading, type name is also fine
 { 'struct': 'foo',
   'data': false }
index 9e4c7b85ff397031d50d2ea42c8c1b8c9f730a9b..69a326d450e9fbf9c6fb7e5464e99f59a441e485 100644 (file)
@@ -1 +1 @@
-tests/qapi-schema/struct-member-invalid.json:2: Member 'a' of 'data' for struct 'foo' should be a dictionary
+tests/qapi-schema/struct-member-invalid.json:1: Member 'a' of 'data' for struct 'foo' should be a type name
index 968e63cb8e61d0a12347f5a9dd1259aedc59f1cf..8f172f7a87e7bc63b0f8bb32a0ae2676b4b8a175 100644 (file)
@@ -1,3 +1,2 @@
-# FIXME error message "should be a dictionary" is wrong, must be type name
 { 'struct': 'foo',
   'data': { 'a': false } }
This page took 0.033927 seconds and 4 git commands to generate.