repr_impl.nim 427 B

12345678910111213141516
  1. #[
  2. other APIs common to system/repr and system/reprjs could be refactored here, eg:
  3. * reprChar
  4. * reprBool
  5. * reprStr
  6. Another possibility in future work would be to have a single include file instead
  7. of system/repr and system/reprjs, and use `when defined(js)` inside it.
  8. ]#
  9. proc reprDiscriminant*(e: int, typ: PNimType): string {.compilerRtl.} =
  10. case typ.kind
  11. of tyEnum: reprEnum(e, typ)
  12. of tyBool: $(e != 0)
  13. else: $e