Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request - macros: Get the NimSymKind of a NimSym #7366

Closed
mratsim opened this issue Mar 19, 2018 · 0 comments · Fixed by #7491
Closed

Feature request - macros: Get the NimSymKind of a NimSym #7366

mratsim opened this issue Mar 19, 2018 · 0 comments · Fixed by #7491

Comments

@mratsim
Copy link
Collaborator

mratsim commented Mar 19, 2018

There doesn't seem to be a way to get the NimSymKind of a symbol.

This would be useful to check if a symbol is a var for example

import macros

var a = @[12345]

macro checkImpl(foo: varargs[typed]): untyped =
  echo foo[0].symbol.getImpl.treerepr
  # echo foo[0].symbol.kind # fails

checkImpl(a)

# Prefix
#   Sym "@"
#   Bracket
#   IntLit 12345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants