tdebugutils.nim 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. discard """
  2. joinable: false
  3. disabled: true
  4. """
  5. #[
  6. This test illustrates some features of `debugutils` to debug the compiler.
  7. ## example
  8. this shows how to enable compiler logging just for a section of user code,
  9. without generating tons of unrelated log messages for code you're not interested
  10. in debugging.
  11. ```sh
  12. # enable some debugging code, e.g. the `when false:` block in `semExpr`
  13. nim c -o:bin/nim_temp --stacktrace -d:debug -d:nimDebugUtils compiler/nim
  14. bin/nim_temp c tests/compiler/tdebugutils.nim
  15. ```
  16. (use --filenames:abs for abs files)
  17. ## result
  18. ("<", "tdebugutils.nim(16, 3)", {.define(nimCompilerDebug).}, nil)
  19. (">", "tdebugutils.nim(17, 3)", let a = 2.5 * 3, {}, nkLetSection)
  20. (">", "tdebugutils.nim(17, 15)", 2.5 * 3, {efAllowDestructor, efWantValue}, nkInfix)
  21. (">", "tdebugutils.nim(17, 11)", 2.5, {efAllowStmt, efDetermineType, efOperand}, nkFloatLit)
  22. ("<", "tdebugutils.nim(17, 11)", 2.5, float64)
  23. (">", "tdebugutils.nim(17, 17)", 3, {efAllowStmt, efDetermineType, efOperand}, nkIntLit)
  24. ("<", "tdebugutils.nim(17, 17)", 3, int literal(3))
  25. ("<", "tdebugutils.nim(17, 15)", 2.5 * 3, float)
  26. ("<", "tdebugutils.nim(17, 3)", let a = 2.5 * 3, nil)
  27. (">", "tdebugutils.nim(18, 3)", {.undef(nimCompilerDebug).}, {}, nkPragma)
  28. ]#
  29. proc main =
  30. {.define(nimCompilerDebug).}
  31. let a = 2.5 * 3
  32. {.undef(nimCompilerDebug).}