Ruby: Add field to slicc machine for generic type
This allows you to have (i.e.) an L2 cache that is not named "L2Cache" but is still a GenericMachineType_L2Cache. This is particularly helpful if the protocol has multiple L2 controllers.
This commit is contained in:
parent
b936619ab4
commit
e98c3c227d
1 changed files with 3 additions and 1 deletions
|
@ -540,9 +540,11 @@ ConvertMachToGenericMach(MachineType machType)
|
|||
{
|
||||
''')
|
||||
for enum in self.enums.itervalues():
|
||||
genericType = self.enums[enum.ident].get('genericType',
|
||||
enum.ident)
|
||||
code('''
|
||||
if (machType == MachineType_${{enum.ident}})
|
||||
return GenericMachineType_${{enum.ident}};
|
||||
return GenericMachineType_${{genericType}};
|
||||
''')
|
||||
code('''
|
||||
panic("cannot convert to a GenericMachineType");
|
||||
|
|
Loading…
Reference in a new issue