build: Add a `name` property to CustomTargetIndex

This is needed to make CustomTargetIndex polymorphic with Target derived
classes, and is used in the build module.
This commit is contained in:
Dylan Baker 2021-08-10 11:36:42 -07:00 committed by Daniel Mensinger
parent d754ee1a7f
commit c9e827a6a1
1 changed files with 4 additions and 0 deletions

View File

@ -2573,6 +2573,10 @@ class CustomTargetIndex(HoldableObject):
self.output = output
self.for_machine = target.for_machine
@property
def name(self) -> str:
return f'{self.target.name}[{self.output}]'
def __repr__(self):
return '<CustomTargetIndex: {!r}[{}]>'.format(
self.target, self.target.get_outputs().index(self.output))