mirror of
https://gitlab.freedesktop.org/xorg/proto/xcbproto.git
synced 2026-05-05 15:48:08 +02:00
assign switch name to bitcases as well (important in case of switch that appear inside another switch)
This commit is contained in:
parent
73c14cd5f2
commit
946817d43e
2 changed files with 13 additions and 4 deletions
|
|
@ -117,7 +117,11 @@ class Expression(object):
|
|||
for p in reversed(parents):
|
||||
fields = dict([(f.field_name, f) for f in p.fields])
|
||||
if self.lenfield_name in fields.keys():
|
||||
self.lenfield_parent = p
|
||||
if p.is_bitcase:
|
||||
# switch is the anchestor
|
||||
self.lenfield_parent = p.parents[-1]
|
||||
else:
|
||||
self.lenfield_parent = p
|
||||
self.lenfield_type = fields[self.lenfield_name].field_type
|
||||
break
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ class Type(object):
|
|||
self.is_union = False
|
||||
self.is_pad = False
|
||||
self.is_switch = False
|
||||
self.is_bitcase = False
|
||||
|
||||
def resolve(self, module):
|
||||
'''
|
||||
|
|
@ -372,12 +373,14 @@ class SwitchType(ComplexType):
|
|||
return
|
||||
# pads = 0
|
||||
|
||||
parents = list(self.parent) + [self]
|
||||
|
||||
# Resolve all of our field datatypes.
|
||||
for index, child in enumerate(list(self.elt)):
|
||||
if child.tag == 'bitcase':
|
||||
# use self.parent to indicate anchestor,
|
||||
# as switch does not contain named fields itself
|
||||
type = BitcaseType(index, child, *self.parent)
|
||||
type = BitcaseType(index, self.name, child, *parents)
|
||||
visible = True
|
||||
|
||||
# Get the full type name for the field
|
||||
|
|
@ -463,12 +466,14 @@ class BitcaseType(ComplexType):
|
|||
'''
|
||||
Derived class representing a struct data type.
|
||||
'''
|
||||
def __init__(self, index, elt, *parent):
|
||||
def __init__(self, index, name, elt, *parent):
|
||||
elts = list(elt)
|
||||
self.expr = Expression(elts[0] if len(elts) else elt, self)
|
||||
ComplexType.__init__(self, ('bitcase%d' % index,), elts[1:])
|
||||
ComplexType.__init__(self, name, elts[1:])
|
||||
self.index = 1
|
||||
self.lenfield_parent = list(parent) + [self]
|
||||
self.parents = list(parent)
|
||||
self.is_bitcase = True
|
||||
|
||||
def make_member_of(self, module, switch_type, field_type, field_name, visible, wire, auto):
|
||||
'''
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue