Files
pork/ast/src/main/kotlin/gay/pizza/pork/ast/LetAssignment.kt

26 lines
732 B
Kotlin
Raw Normal View History

package gay.pizza.pork.ast
2023-08-21 23:31:40 -07:00
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
2023-08-21 23:31:40 -07:00
@Serializable
@SerialName("letAssignment")
class LetAssignment(val symbol: Symbol, val value: Expression) : Expression() {
override val type: NodeType = NodeType.LetAssignment
override fun <T> visitChildren(visitor: NodeVisitor<T>): List<T> =
visitor.visitNodes(symbol, value)
2023-08-21 00:58:05 -07:00
override fun equals(other: Any?): Boolean {
if (other !is LetAssignment) return false
2023-08-21 00:58:05 -07:00
return other.symbol == symbol && other.value == value
}
override fun hashCode(): Int {
var result = symbol.hashCode()
result = 31 * result + value.hashCode()
result = 31 * result + type.hashCode()
return result
}
}