ffi: new native function format

This commit is contained in:
2023-09-22 00:26:24 -07:00
parent f60715dfb3
commit 83c24843a3
14 changed files with 75 additions and 57 deletions

View File

@ -300,8 +300,8 @@ types:
values:
- name: form
type: Symbol
- name: definition
type: StringLiteral
- name: definitions
type: List<StringLiteral>
IndexedBy:
parent: Expression
values:

View File

@ -6,23 +6,23 @@ import kotlinx.serialization.Serializable
@Serializable
@SerialName("native")
class Native(val form: Symbol, val definition: StringLiteral) : Node() {
class Native(val form: Symbol, val definitions: List<StringLiteral>) : Node() {
override val type: NodeType = NodeType.Native
override fun <T> visitChildren(visitor: NodeVisitor<T>): List<T> =
visitor.visitNodes(form, definition)
visitor.visitAll(listOf(form), definitions)
override fun <T> visit(visitor: NodeVisitor<T>): T =
visitor.visitNative(this)
override fun equals(other: Any?): Boolean {
if (other !is Native) return false
return other.form == form && other.definition == definition
return other.form == form && other.definitions == definitions
}
override fun hashCode(): Int {
var result = form.hashCode()
result = 31 * result + definition.hashCode()
result = 31 * result + definitions.hashCode()
result = 31 * result + type.hashCode()
return result
}