mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 01:14:41 +00:00
24 lines
604 B
Nim
24 lines
604 B
Nim
#
|
|
#
|
|
# Nim's Runtime Library
|
|
# (c) Copyright 2012 Andreas Rumpf
|
|
#
|
|
# See the file "copying.txt", included in this
|
|
# distribution, for details about the copyright.
|
|
#
|
|
|
|
proc reprInt(x: int64): string {.compilerproc.} = return $x
|
|
|
|
proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} =
|
|
if ntfEnumHole notin typ.flags:
|
|
if e <% typ.node.len:
|
|
return $typ.node.sons[e].name
|
|
else:
|
|
# ugh we need a slow linear search:
|
|
var n = typ.node
|
|
var s = n.sons
|
|
for i in 0 .. n.len-1:
|
|
if s[i].offset == e: return $s[i].name
|
|
result = $e & " (invalid data!)"
|
|
|