Add InstructionFormat.imm_fields.

Consolidate the imm_members and imm_kinds into this list so the
FormatField is the single definition of these properties.

This makes it easier to access the precomputed FormatFields
parametrically, avoiding going through getattr().

This is better for type checking too.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-31 10:12:37 -07:00
parent 2f50ae3166
commit 63a6ade0a5
5 changed files with 46 additions and 45 deletions

View File

@@ -90,7 +90,7 @@ def emit_instp(instp, fmt):
fnames = set() # type: Set[str]
for p in leafs:
assert isinstance(p, FieldPredicate)
fnames.add(p.field.name)
fnames.add(p.field.rust_name())
fields = ', '.join(sorted(fnames))
with fmt.indented('{} => {{'.format(instp.number), '}'):