diff options
author | Adam Strzelecki <ono@java.pl> | 2015-09-28 23:34:52 +0200 |
---|---|---|
committer | Adam Strzelecki <ono@java.pl> | 2015-09-28 23:34:52 +0200 |
commit | 4be68447564fbf19d2c9e260ecb127b391dece07 (patch) | |
tree | 14664d90b52ebd30fe8c2a7f7deb2996cb2c8bc7 /compiler/vm.nim | |
parent | bb7604c06fb2adc6999d47fdfcbf9cf2979bef9e (diff) | |
download | Nim-4be68447564fbf19d2c9e260ecb127b391dece07.tar.gz |
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".
Diffstat (limited to 'compiler/vm.nim')
-rw-r--r-- | compiler/vm.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/vm.nim b/compiler/vm.nim index 4dd3b5232..ad4aa1017 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -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: |