ast: fix codegen of equals to not produce warnings

This commit is contained in:
2023-09-23 15:53:54 -07:00
parent c340cfb86d
commit a292449b6a
5 changed files with 23 additions and 25 deletions

View File

@ -12,10 +12,8 @@ class Break : Expression() {
override fun <T> visit(visitor: NodeVisitor<T>): T =
visitor.visitBreak(this)
override fun equals(other: Any?): Boolean {
if (other !is Break) return false
return true
}
override fun equals(other: Any?): Boolean =
other is Break
override fun hashCode(): Int =
31 * type.hashCode()

View File

@ -12,10 +12,8 @@ class Continue : Expression() {
override fun <T> visit(visitor: NodeVisitor<T>): T =
visitor.visitContinue(this)
override fun equals(other: Any?): Boolean {
if (other !is Continue) return false
return true
}
override fun equals(other: Any?): Boolean =
other is Continue
override fun hashCode(): Int =
31 * type.hashCode()

View File

@ -12,10 +12,8 @@ class NoneLiteral : Expression() {
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 equals(other: Any?): Boolean =
other is NoneLiteral
override fun hashCode(): Int =
31 * type.hashCode()