2023-09-03 23:15:21 -07:00
|
|
|
package gay.pizza.pork.ast
|
2023-08-21 00:47:14 -07:00
|
|
|
|
2023-08-21 23:31:40 -07:00
|
|
|
import kotlinx.serialization.SerialName
|
|
|
|
import kotlinx.serialization.Serializable
|
2023-08-21 00:47:14 -07:00
|
|
|
|
2023-08-21 23:31:40 -07:00
|
|
|
@Serializable
|
2023-09-04 02:33:13 -07:00
|
|
|
@SerialName("letAssignment")
|
|
|
|
class LetAssignment(val symbol: Symbol, val value: Expression) : Expression() {
|
|
|
|
override val type: NodeType = NodeType.LetAssignment
|
2023-08-21 00:47:14 -07:00
|
|
|
|
|
|
|
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 {
|
2023-09-04 02:33:13 -07:00
|
|
|
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
|
|
|
|
}
|
2023-08-21 00:47:14 -07:00
|
|
|
}
|