mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-17 20:01:31 +00:00
language: none support
This commit is contained in:
@ -56,6 +56,9 @@ class NodeCoalescer(val handler: (Node) -> Unit) : NodeVisitor<Unit> {
|
||||
override fun visitNative(node: Native): Unit =
|
||||
handle(node)
|
||||
|
||||
override fun visitNoneLiteral(node: NoneLiteral): Unit =
|
||||
handle(node)
|
||||
|
||||
override fun visitParentheses(node: Parentheses): Unit =
|
||||
handle(node)
|
||||
|
||||
|
@ -24,6 +24,7 @@ enum class NodeType(val parent: NodeType? = null) {
|
||||
ListLiteral(Expression),
|
||||
LongLiteral(Expression),
|
||||
Native(Node),
|
||||
NoneLiteral(Expression),
|
||||
Parentheses(Expression),
|
||||
PrefixOperation(Expression),
|
||||
SetAssignment(Expression),
|
||||
|
@ -38,6 +38,8 @@ interface NodeVisitor<T> {
|
||||
|
||||
fun visitNative(node: Native): T
|
||||
|
||||
fun visitNoneLiteral(node: NoneLiteral): T
|
||||
|
||||
fun visitParentheses(node: Parentheses): T
|
||||
|
||||
fun visitPrefixOperation(node: PrefixOperation): T
|
||||
|
@ -29,6 +29,7 @@ fun <T> NodeVisitor<T>.visit(node: Node): T =
|
||||
is ForIn -> visitForIn(node)
|
||||
is Break -> visitBreak(node)
|
||||
is Continue -> visitContinue(node)
|
||||
is NoneLiteral -> visitNoneLiteral(node)
|
||||
is Native -> visitNative(node)
|
||||
}
|
||||
|
||||
|
22
ast/src/main/kotlin/gay/pizza/pork/ast/NoneLiteral.kt
Normal file
22
ast/src/main/kotlin/gay/pizza/pork/ast/NoneLiteral.kt
Normal file
@ -0,0 +1,22 @@
|
||||
// GENERATED CODE FROM PORK AST CODEGEN
|
||||
package gay.pizza.pork.ast
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("noneLiteral")
|
||||
class NoneLiteral : Expression() {
|
||||
override val type: NodeType = NodeType.NoneLiteral
|
||||
|
||||
override fun <T> visit(visitor: NodeVisitor<T>): T =
|
||||
visitor.visitNoneLiteral(this)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is NoneLiteral) return false
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int =
|
||||
31 * type.hashCode()
|
||||
}
|
Reference in New Issue
Block a user