imports are now python style with a twist: forms! import std ffi and import local myfile

This commit is contained in:
2023-09-06 22:43:03 -07:00
parent 0e4362eefb
commit 81296ee1d1
22 changed files with 58 additions and 50 deletions

View File

@ -111,9 +111,9 @@ types:
parent: Declaration
values:
- name: form
type: Symbol?
- name: path
type: StringLiteral
type: Symbol
- name: components
type: List<Symbol>
IntLiteral:
parent: Expression
values:

View File

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