mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-03 13:11:32 +00:00
language: today, we killed lambdas
This commit is contained in:
@ -115,13 +115,6 @@ types:
|
||||
values:
|
||||
- name: value
|
||||
type: Int
|
||||
Lambda:
|
||||
parent: Expression
|
||||
values:
|
||||
- name: arguments
|
||||
type: List<Symbol>
|
||||
- name: expressions
|
||||
type: List<Expression>
|
||||
ListLiteral:
|
||||
parent: Expression
|
||||
values:
|
||||
|
@ -1,29 +0,0 @@
|
||||
// GENERATED CODE FROM PORK AST CODEGEN
|
||||
package gay.pizza.pork.ast
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@SerialName("lambda")
|
||||
class Lambda(val arguments: List<Symbol>, val expressions: List<Expression>) : Expression() {
|
||||
override val type: NodeType = NodeType.Lambda
|
||||
|
||||
override fun <T> visitChildren(visitor: NodeVisitor<T>): List<T> =
|
||||
visitor.visitAll(arguments, expressions)
|
||||
|
||||
override fun <T> visit(visitor: NodeVisitor<T>): T =
|
||||
visitor.visitLambda(this)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is Lambda) return false
|
||||
return other.arguments == arguments && other.expressions == expressions
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = arguments.hashCode()
|
||||
result = 31 * result + expressions.hashCode()
|
||||
result = 31 * result + type.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
@ -29,9 +29,6 @@ class NodeCoalescer(val handler: (Node) -> Unit) : NodeVisitor<Unit> {
|
||||
override fun visitIntLiteral(node: IntLiteral): Unit =
|
||||
handle(node)
|
||||
|
||||
override fun visitLambda(node: Lambda): Unit =
|
||||
handle(node)
|
||||
|
||||
override fun visitLetAssignment(node: LetAssignment): Unit =
|
||||
handle(node)
|
||||
|
||||
|
@ -15,7 +15,6 @@ enum class NodeType(val parent: NodeType? = null) {
|
||||
ImportDeclaration(Declaration),
|
||||
InfixOperation(Expression),
|
||||
IntLiteral(Expression),
|
||||
Lambda(Expression),
|
||||
LetAssignment(Expression),
|
||||
ListLiteral(Expression),
|
||||
Parentheses(Expression),
|
||||
|
@ -20,8 +20,6 @@ interface NodeVisitor<T> {
|
||||
|
||||
fun visitIntLiteral(node: IntLiteral): T
|
||||
|
||||
fun visitLambda(node: Lambda): T
|
||||
|
||||
fun visitLetAssignment(node: LetAssignment): T
|
||||
|
||||
fun visitListLiteral(node: ListLiteral): T
|
||||
|
@ -14,7 +14,6 @@ fun <T> NodeVisitor<T>.visit(node: Node): T =
|
||||
is If -> visitIf(node)
|
||||
is ImportDeclaration -> visitImportDeclaration(node)
|
||||
is IntLiteral -> visitIntLiteral(node)
|
||||
is Lambda -> visitLambda(node)
|
||||
is ListLiteral -> visitListLiteral(node)
|
||||
is Parentheses -> visitParentheses(node)
|
||||
is PrefixOperation -> visitPrefixOperation(node)
|
||||
|
Reference in New Issue
Block a user