Skip to content

Commit

Permalink
internal: astrepr.debug now useful for PType (#798)
Browse files Browse the repository at this point in the history
## Summary

`astrepr.debug` overload for `PType` now provides more tailored output,
reducing spam and surfacing more useful information.

## Details

Previously, `astrepr.debug` used a generic `implicitTReprConf` when
generating output. This meant continually fiddling with that set and/or
having largely useless/spammy output for `PType` vs `PSym` vs `PNode`,
etc. Now the `PType` overload has its own config that can be tailored
for types.
  • Loading branch information
saem authored Jul 15, 2023
1 parent ae7e6b7 commit d0a1ab2
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions compiler/utils/astrepr.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1234,8 +1234,21 @@ template debug*(it: PSym) =

template debug*(it: PType) =
## Print tree representation of a PType for compiler debugging
# TODO: customize the TReprConf here
debugAux(implicitDebugConfRef, it, implicitTReprConf, instLoc())
# TODO: create a PType specific implicitTReprConf
var conf = implicitTReprConf
conf.flags = conf.flags +
{
trfShowTypeAst, trfShowTypeId,

trfShowTypeFlags
} -
{
trfShowTypeSym, trfShowSymLineInfo,
trfShowSymFlags, trfShowSymMagic,

# trfShowNodeTypes,
trfShowNodeLineInfo, trfShowNodeFlags}
debugAux(implicitDebugConfRef, it, conf, instLoc())

Check warning on line 1251 in compiler/utils/astrepr.nim

View workflow job for this annotation

GitHub Actions / Build release binaries (macOS)

DEBUG proc, should not be used in the final build!; debugAux is deprecated [Deprecated]

Check warning on line 1251 in compiler/utils/astrepr.nim

View workflow job for this annotation

GitHub Actions / Build release binaries (Linux)

DEBUG proc, should not be used in the final build!; debugAux is deprecated [Deprecated]

Check warning on line 1251 in compiler/utils/astrepr.nim

View workflow job for this annotation

GitHub Actions / Build docs and release artifacts (macOS)

DEBUG proc, should not be used in the final build!; debugAux is deprecated [Deprecated]

Check warning on line 1251 in compiler/utils/astrepr.nim

View workflow job for this annotation

GitHub Actions / Build docs and release artifacts (Linux)

DEBUG proc, should not be used in the final build!; debugAux is deprecated [Deprecated]

template debug*(it: PIdent) =
## Print tree representation of a PIdent for compiler debugging
Expand Down

0 comments on commit d0a1ab2

Please sign in to comment.