diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2021-08-13 00:35:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 09:35:48 +0200 |
commit | b24812df5f952427c1266e48c40b7956bdf3d999 (patch) | |
tree | 9bbbb23a1446eedb10be7c52fe07013c4b172740 /lib/system/repr_v2.nim | |
parent | 3a1109a53be172a92c63ebc5bdb69c45e78e9ca6 (diff) | |
download | Nim-b24812df5f952427c1266e48c40b7956bdf3d999.tar.gz |
properly fix #10053 ; `FieldDefect` msg now shows discriminant value + lineinfo, in all backends (c,vm,js) (#11955)
* fix #10053 FieldError for vm * fixup * FieldError now also shows runtime value of discriminant * fix field error reporting in vm * also report culprit line info in err msg * fix errors for newruntime 2 * fix for js * fixup * PRTEMP4 * works * works * works perfect * refactor * std/private/repr_impl * suppport --gc:arc * cleanup * refactor * simplify * simplify * simplify * fixup * move out compiler.vmgen.genCustom * fixup * fixup * add tests * revert compiler/debugutils.nim * simplify reprDiscriminant * fixup * lib/std/private/repr_impl.nim -> lib/system/repr_impl.nim * try to fix D20210812T165220 * honor --declaredlocs * control toFileLineCol via --declaredlocs
Diffstat (limited to 'lib/system/repr_v2.nim')
-rw-r--r-- | lib/system/repr_v2.nim | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/system/repr_v2.nim b/lib/system/repr_v2.nim index f99f09799..ba94b881d 100644 --- a/lib/system/repr_v2.nim +++ b/lib/system/repr_v2.nim @@ -1,3 +1,5 @@ +include system/inclrtl + proc isNamedTuple(T: typedesc): bool {.magic: "TypeTrait".} ## imported from typetraits @@ -66,6 +68,11 @@ proc repr*[Enum: enum](x: Enum): string {.magic: "EnumToStr", noSideEffect.} ## If a `repr` operator for a concrete enumeration is provided, this is ## used instead. (In other words: *Overwriting* is possible.) +proc reprDiscriminant*(e: int): string {.compilerproc.} = + # repr and reprjs can use `PNimType` to symbolize `e`; making this work here + # would require a way to pass the set of enum stringified values to cgen. + $e + proc repr*(p: pointer): string = ## repr of pointer as its hexadecimal value if p == nil: |