This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
2023-12-01 20:16:08 +00:00

14 lines
449 B
Kotlin

package tinyvm
sealed class Node(type: String) : Object(type)
class Tree(val nodes: Map<String, Node>) : Node("tree") {
// For simplicity just use the hex-formatted hash, not the actual value like git does.
override val data: String
get() =
nodes.map { (name, node) ->
"${node.type} $name\u0000${node.hash()}"
}.sorted().joinToString()
}
class Blob(override val data: String) : Node("blob")