mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 13:11:32 +00:00
imports are now python style with a twist: forms! import std ffi and import local myfile
This commit is contained in:
@ -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:
|
||||
|
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user