mirror of
https://github.com/mcanlas/6502-opcodes.git
synced 2025-03-12 07:29:31 +00:00
jump body is not lazy
This commit is contained in:
parent
e9d027f362
commit
4adb4ab4cd
@ -10,7 +10,7 @@ import com.htmlism.firepower.core.*
|
||||
sealed trait MetaIntent
|
||||
|
||||
object MetaIntent:
|
||||
case class Jump(target: String, description: String, xs: () => List[MetaIntent.Jump]) extends MetaIntent
|
||||
case class Jump(target: String, description: String, xs: List[MetaIntent.Jump]) extends MetaIntent
|
||||
|
||||
object Jump:
|
||||
def toIntent(j: Jump): AsmBlock.Intent =
|
||||
|
@ -4,13 +4,10 @@ import cats.syntax.all.*
|
||||
|
||||
import com.htmlism.firepower.core.AsmBlock._
|
||||
|
||||
case class Subroutine(name: String, description: String, intents: List[MetaIntent.Jump]):
|
||||
case class Subroutine(name: String, description: String, intents: () => List[MetaIntent.Jump]):
|
||||
def call: MetaIntent.Jump =
|
||||
MetaIntent.Jump(name, description, () => intents)
|
||||
|
||||
def attach: NamedCodeBlock =
|
||||
NamedCodeBlock(name, "this is a named block".some, intents.map(_ => Intent("TODO".some, Nil)))
|
||||
MetaIntent.Jump(name, description, intents())
|
||||
|
||||
object Subroutine:
|
||||
def apply(name: String, description: String): Subroutine =
|
||||
Subroutine(name, description, Nil)
|
||||
Subroutine(name, description, () => Nil)
|
||||
|
@ -19,9 +19,10 @@ object SnakeEasy6502:
|
||||
lazy val init =
|
||||
Subroutine("init", "initializes values")
|
||||
.copy(intents =
|
||||
List(
|
||||
initSnake.call
|
||||
)
|
||||
() =>
|
||||
List(
|
||||
initSnake.call
|
||||
)
|
||||
)
|
||||
|
||||
lazy val loop =
|
||||
@ -62,7 +63,7 @@ object SnakeEasy6502:
|
||||
)
|
||||
)
|
||||
|
||||
callGraphRecur(callGraph.updated(head.target, sub), todo ::: head.xs())
|
||||
callGraphRecur(callGraph.updated(head.target, sub), todo ::: head.xs)
|
||||
|
||||
case Nil =>
|
||||
callGraph
|
||||
|
Loading…
x
Reference in New Issue
Block a user