mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 05:50:30 +00:00
Make expandMacro show private fields (#24522)
Was debugging with `--expandMacro` and noticed that private fields
weren't exported.
Passes extra flags to the renderer to make them be shown
(cherry picked from commit f80ce139d5)
This commit is contained in:
@@ -526,7 +526,9 @@ proc semMacroExpr(c: PContext, n, nOrig: PNode, sym: PSym,
|
||||
if efNoSemCheck notin flags:
|
||||
result = semAfterMacroCall(c, n, result, sym, flags, expectedType)
|
||||
if c.config.macrosToExpand.hasKey(sym.name.s):
|
||||
message(c.config, nOrig.info, hintExpandMacro, renderTree(result))
|
||||
message(c.config, nOrig.info, hintExpandMacro, renderTree(result, {
|
||||
renderNonExportedFields, renderDocComments, renderNoComments
|
||||
}))
|
||||
result = wrapInComesFrom(nOrig.info, sym, result)
|
||||
popInfoContext(c.config)
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
discard """
|
||||
cmd: "nim c --expandMacro:foo $file"
|
||||
nimout: '''texpandmacro.nim(17, 1) Hint: expanded macro:
|
||||
nimout: '''texpandmacro.nim(20, 1) Hint: expanded macro:
|
||||
echo ["injected echo"]
|
||||
var x = 4 [ExpandMacro]
|
||||
var x = 4
|
||||
type
|
||||
Hello = object
|
||||
private: string [ExpandMacro]
|
||||
'''
|
||||
output: '''injected echo'''
|
||||
"""
|
||||
@@ -16,3 +19,6 @@ macro foo(x: untyped): untyped =
|
||||
|
||||
foo:
|
||||
var x = 4
|
||||
type
|
||||
Hello = object
|
||||
private: string
|
||||
|
||||
Reference in New Issue
Block a user