Fix quoted idents in ctags (#24317)

Running `ctags` on files with quoted symbols (e.g. `$`) would list \`
instead of the full ident. Issue was the result getting reassigned at
the end to a \` instead of appending
This commit is contained in:
Jake Leahy
2024-10-20 01:39:15 +11:00
committed by GitHub
parent ae9287c4f3
commit 93c24fe1c5
2 changed files with 17 additions and 1 deletions

View File

@@ -830,7 +830,7 @@ proc getName(n: PNode): string =
of nkAccQuoted:
result = "`"
for i in 0..<n.len: result.add(getName(n[i]))
result = "`"
result.add('`')
of nkOpenSymChoice, nkClosedSymChoice, nkOpenSym:
result = getName(n[0])
else:

16
tests/tools/tctags.nim Normal file
View File

@@ -0,0 +1,16 @@
discard """
cmd: '''nim ctags --stdout $file'''
nimout: '''
Foo
hello
`$$`
'''
action: "compile"
"""
type
Foo = object
proc hello() = discard
proc `$`(x: Foo): string = "foo"