vm: Don't fail on unknown enum position to string

Previously trying to convert constant of enum type, where this enum type has no
entry with given constant position leaded to "internal error: opConv for enum".

Instead of producing error, now we gracefully convert it to "EnumType position".
This commit is contained in:
Adam Strzelecki
2015-09-28 23:34:52 +02:00
parent bb7604c06f
commit 4be6844756

View File

@@ -311,7 +311,7 @@ proc opConv*(dest: var TFullReg, src: TFullReg, desttyp, srctyp: PType): bool =
if f.position == x:
dest.node.strVal = if f.ast.isNil: f.name.s else: f.ast.strVal
return
internalError("opConv for enum")
dest.node.strVal = styp.sym.name.s & " " & $x
of tyInt..tyInt64:
dest.node.strVal = $src.intVal
of tyUInt..tyUInt64: