add label and comment show

This commit is contained in:
Mark Canlas 2020-08-15 17:10:37 -04:00
parent 8ac49b7f10
commit 973172f90e
3 changed files with 31 additions and 0 deletions

View File

@ -6,4 +6,14 @@ trait BitField[A] {
def comment: String
def labels: NonEmptyList[String]
/**
* ASM-safe label
*/
def label(x: A): String
/**
* Comment string
*/
def comment(x: A): String
}

View File

@ -6,4 +6,14 @@ trait EnumAsm[A] {
def comment: String
def labels: NonEmptyList[String]
/**
* ASM-safe label
*/
def label(x: A): String
/**
* Comment string
*/
def comment(x: A): String
}

View File

@ -117,6 +117,12 @@ object Foo {
def labels: NonEmptyList[String] =
NonEmptyList.of("courage", "wisdom", "power")
def label(x: Foo): String =
"fooNotEnum"
def comment(x: Foo): String =
"Foo not an enum"
}
implicit val bitFieldFoo: BitField[Foo] =
@ -127,5 +133,10 @@ object Foo {
def labels: NonEmptyList[String] =
NonEmptyList.of("up", "down", "left", "right")
def label(x: Foo): String =
"fooNotBitField"
def comment(x: Foo): String =
"Foo not a bit field"
}
}