|
@@ -215,7 +215,7 @@ def visit_object_type(
|
|
features: List[QAPISchemaFeature],
|
|
features: List[QAPISchemaFeature],
|
|
base: Optional[QAPISchemaObjectType],
|
|
base: Optional[QAPISchemaObjectType],
|
|
members: List[QAPISchemaObjectTypeMember],
|
|
members: List[QAPISchemaObjectTypeMember],
|
|
- variants: Optional[QAPISchemaVariants],
|
|
|
|
|
|
+ variants: Optional[QAPISchemaBranches],
|
|
) -> None:
|
|
) -> None:
|
|
pass
|
|
pass
|
|
|
|
|
|
@@ -226,7 +226,7 @@ def visit_object_type_flat(
|
|
ifcond: QAPISchemaIfCond,
|
|
ifcond: QAPISchemaIfCond,
|
|
features: List[QAPISchemaFeature],
|
|
features: List[QAPISchemaFeature],
|
|
members: List[QAPISchemaObjectTypeMember],
|
|
members: List[QAPISchemaObjectTypeMember],
|
|
- variants: Optional[QAPISchemaVariants],
|
|
|
|
|
|
+ variants: Optional[QAPISchemaBranches],
|
|
) -> None:
|
|
) -> None:
|
|
pass
|
|
pass
|
|
|
|
|
|
@@ -236,7 +236,7 @@ def visit_alternate_type(
|
|
info: Optional[QAPISourceInfo],
|
|
info: Optional[QAPISourceInfo],
|
|
ifcond: QAPISchemaIfCond,
|
|
ifcond: QAPISchemaIfCond,
|
|
features: List[QAPISchemaFeature],
|
|
features: List[QAPISchemaFeature],
|
|
- variants: QAPISchemaVariants,
|
|
|
|
|
|
+ variants: QAPISchemaAlternatives,
|
|
) -> None:
|
|
) -> None:
|
|
pass
|
|
pass
|
|
|
|
|
|
@@ -524,7 +524,7 @@ def __init__(
|
|
features: Optional[List[QAPISchemaFeature]],
|
|
features: Optional[List[QAPISchemaFeature]],
|
|
base: Optional[str],
|
|
base: Optional[str],
|
|
local_members: List[QAPISchemaObjectTypeMember],
|
|
local_members: List[QAPISchemaObjectTypeMember],
|
|
- variants: Optional[QAPISchemaVariants],
|
|
|
|
|
|
+ variants: Optional[QAPISchemaBranches],
|
|
):
|
|
):
|
|
# struct has local_members, optional base, and no variants
|
|
# struct has local_members, optional base, and no variants
|
|
# union has base, variants, and no local_members
|
|
# union has base, variants, and no local_members
|
|
@@ -651,7 +651,7 @@ def __init__(
|
|
doc: Optional[QAPIDoc],
|
|
doc: Optional[QAPIDoc],
|
|
ifcond: Optional[QAPISchemaIfCond],
|
|
ifcond: Optional[QAPISchemaIfCond],
|
|
features: List[QAPISchemaFeature],
|
|
features: List[QAPISchemaFeature],
|
|
- variants: QAPISchemaVariants,
|
|
|
|
|
|
+ variants: QAPISchemaAlternatives,
|
|
):
|
|
):
|
|
super().__init__(name, info, doc, ifcond, features)
|
|
super().__init__(name, info, doc, ifcond, features)
|
|
assert variants.tag_member
|
|
assert variants.tag_member
|
|
@@ -833,6 +833,22 @@ def check_clash(
|
|
v.type.check_clash(info, dict(seen))
|
|
v.type.check_clash(info, dict(seen))
|
|
|
|
|
|
|
|
|
|
|
|
+class QAPISchemaBranches(QAPISchemaVariants):
|
|
|
|
+ def __init__(self,
|
|
|
|
+ info: QAPISourceInfo,
|
|
|
|
+ variants: List[QAPISchemaVariant],
|
|
|
|
+ tag_name: str):
|
|
|
|
+ super().__init__(tag_name, info, None, variants)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+class QAPISchemaAlternatives(QAPISchemaVariants):
|
|
|
|
+ def __init__(self,
|
|
|
|
+ info: QAPISourceInfo,
|
|
|
|
+ variants: List[QAPISchemaVariant],
|
|
|
|
+ tag_member: QAPISchemaObjectTypeMember):
|
|
|
|
+ super().__init__(None, info, tag_member, variants)
|
|
|
|
+
|
|
|
|
+
|
|
class QAPISchemaMember:
|
|
class QAPISchemaMember:
|
|
""" Represents object members, enum members and features """
|
|
""" Represents object members, enum members and features """
|
|
role = 'member'
|
|
role = 'member'
|
|
@@ -1388,8 +1404,8 @@ def _def_union_type(self, expr: QAPIExpression) -> None:
|
|
self._def_definition(
|
|
self._def_definition(
|
|
QAPISchemaObjectType(name, info, expr.doc, ifcond, features,
|
|
QAPISchemaObjectType(name, info, expr.doc, ifcond, features,
|
|
base, members,
|
|
base, members,
|
|
- QAPISchemaVariants(
|
|
|
|
- tag_name, info, None, variants)))
|
|
|
|
|
|
+ QAPISchemaBranches(
|
|
|
|
+ info, variants, tag_name)))
|
|
|
|
|
|
def _def_alternate_type(self, expr: QAPIExpression) -> None:
|
|
def _def_alternate_type(self, expr: QAPIExpression) -> None:
|
|
name = expr['alternate']
|
|
name = expr['alternate']
|
|
@@ -1407,7 +1423,7 @@ def _def_alternate_type(self, expr: QAPIExpression) -> None:
|
|
self._def_definition(
|
|
self._def_definition(
|
|
QAPISchemaAlternateType(
|
|
QAPISchemaAlternateType(
|
|
name, info, expr.doc, ifcond, features,
|
|
name, info, expr.doc, ifcond, features,
|
|
- QAPISchemaVariants(None, info, tag_member, variants)))
|
|
|
|
|
|
+ QAPISchemaAlternatives(info, variants, tag_member)))
|
|
|
|
|
|
def _def_command(self, expr: QAPIExpression) -> None:
|
|
def _def_command(self, expr: QAPIExpression) -> None:
|
|
name = expr['command']
|
|
name = expr['command']
|