summary refs log blame commit diff stats
path: root/lib/system/repr_impl.nim
blob: b9ec1890f49e2c4b382142a5f3ba9eacf1766699 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                 
#[
other APIs common to system/repr and system/reprjs could be refactored here, eg:
* reprChar
* reprBool
* reprStr

Another possibility in future work would be to have a single include file instead
of system/repr and system/reprjs, and use `when defined(js)` inside it.
]#

proc reprDiscriminant*(e: int, typ: PNimType): string {.compilerRtl.} =
  case typ.kind
  of tyEnum: reprEnum(e, typ)
  of tyBool: $(e != 0)
  else: $e