rename definable to named resource

This commit is contained in:
Mark Canlas 2020-08-26 03:02:10 -04:00
parent cfb6bbbc92
commit c20b6f833c
4 changed files with 8 additions and 8 deletions

View File

@ -74,7 +74,7 @@ class DefinitionGroupContext {
private val xs: ListBuffer[Definition[_]] =
ListBuffer()
def push[A](x: A)(implicit ev: Definable[A]): Unit =
def push[A](x: A)(implicit ev: NamedResource[A]): Unit =
ev
.toDefinitions(x)
.foreach(xs.append)
@ -93,8 +93,8 @@ case class Definition[A: Operand](name: String, x: A, comment: Option[String]) {
}
object Definition {
implicit def definitionDefinable[A]: Definable[Definition[A]] =
new Definable[Definition[A]] {
implicit def namedResourceForDefinition[A]: NamedResource[Definition[A]] =
new NamedResource[Definition[A]] {
def toDefinitions(x: Definition[A]): List[Definition[_]] =
List(x)
}

View File

@ -1,6 +1,6 @@
package com.htmlism.mos6502.dsl
trait Definable[A] {
trait NamedResource[A] {
/**
* A `Definable` can emit multiple definitions. Usually in the case of `word`s being split across two byte-definitions

View File

@ -20,8 +20,8 @@ case class ReadWriteLocation[A](name: String, address: ZeroAddress) {
}
object ReadWriteLocation {
implicit def readWriteLocationDefinable[A]: Definable[ReadWriteLocation[A]] =
new Definable[ReadWriteLocation[A]] {
implicit def namedResourceForReadWriteLocation[A]: NamedResource[ReadWriteLocation[A]] =
new NamedResource[ReadWriteLocation[A]] {
def toDefinitions(x: ReadWriteLocation[A]): List[Definition[ZeroAddress]] =
List {
Definition(x.name, x.address, "Read/write location for A values")

View File

@ -17,8 +17,8 @@ case class VolatileDevice[A](name: String, address: ZeroAddress) {
}
object VolatileDevice {
implicit def volatileDeviceDefinable[A]: Definable[VolatileDevice[A]] =
new Definable[VolatileDevice[A]] {
implicit def namedResourceForVolatileDevice[A]: NamedResource[VolatileDevice[A]] =
new NamedResource[VolatileDevice[A]] {
def toDefinitions(x: VolatileDevice[A]): List[Definition[ZeroAddress]] =
List {
Definition(x.name, x.address, "Volatile generator for A values")