Add an inst.all_typevars() method.

Get all type variables controlling an instruction, whether it is
polymorphic or not.
This commit is contained in:
Jakob Stoklund Olesen
2017-07-28 14:45:56 -07:00
parent dd5bbc298e
commit 9df0b09301
2 changed files with 11 additions and 5 deletions

View File

@@ -267,6 +267,16 @@ class Instruction(object):
return other_tvs
def all_typevars(self):
# type: () -> List[TypeVar]
"""
Get a list of all type variables in the instruction.
"""
if self.is_polymorphic:
return [self.ctrl_typevar] + self.other_typevars
else:
return []
@staticmethod
def _to_operand_tuple(x):
# type: (Union[Sequence[Operand], Operand]) -> Tuple[Operand, ...]