1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-23 23:30:22 +00:00

Enums cant have more than 256 items

This commit is contained in:
Karol Stasiak 2018-12-19 01:14:02 +01:00
parent 1b8a7c9bb3
commit 39a9cde375

View File

@ -694,6 +694,9 @@ class Environment(val parent: Option[Environment], val prefix: String, val cpuFa
addThing(ConstantThing(stmt.name + ".count", NumericConstant(size, 1), get[Type]("byte")), stmt.position)
Some(size)
} else None
if (count.exists(_ > 256)) {
log.error(s"Enum `${stmt.name} has more than 256 constants.", stmt.position)
}
val t = EnumType(stmt.name, count)
addThing(t, stmt.position)
var value = Constant.Zero