tdumpastgen.nim 842 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. discard """
  2. nimout: '''nnkStmtList.newTree(
  3. nnkVarSection.newTree(
  4. nnkIdentDefs.newTree(
  5. newIdentNode("x"),
  6. newEmptyNode(),
  7. nnkCall.newTree(
  8. nnkDotExpr.newTree(
  9. newIdentNode("baz"),
  10. newIdentNode("create")
  11. ),
  12. newLit(56)
  13. )
  14. )
  15. ),
  16. nnkProcDef.newTree(
  17. newIdentNode("foo"),
  18. newEmptyNode(),
  19. newEmptyNode(),
  20. nnkFormalParams.newTree(
  21. newEmptyNode()
  22. ),
  23. newEmptyNode(),
  24. newEmptyNode(),
  25. nnkStmtList.newTree(
  26. newCommentStmtNode("This is a docstring"),
  27. nnkCommand.newTree(
  28. newIdentNode("echo"),
  29. newLit("bar")
  30. )
  31. )
  32. )
  33. )'''
  34. """
  35. # disabled; can't work as the output is done by the compiler
  36. import macros
  37. dumpAstGen:
  38. var x = baz.create(56)
  39. proc foo() =
  40. ## This is a docstring
  41. echo "bar"