From f9426bfcd54258730e14076b541cb20b7f86f6df Mon Sep 17 00:00:00 2001 From: Araq Date: Wed, 24 Jul 2013 21:58:17 +0200 Subject: added macros.genSym --- lib/core/macros.nim | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'lib/core') diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 720b15189..9130c3ffb 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -85,11 +85,13 @@ type TNimTypeKinds* = set[TNimrodTypeKind] TNimrodSymKind* = enum nskUnknown, nskConditional, nskDynLib, nskParam, - nskGenericParam, nskTemp, nskType, nskConst, - nskVar, nskProc, nskMethod, nskIterator, + nskGenericParam, nskTemp, nskModule, nskType, nskVar, nskLet, + nskConst, nskResult, + nskProc, nskMethod, nskIterator, nskConverter, nskMacro, nskTemplate, nskField, - nskEnumField, nskForVar, nskModule, nskLabel, + nskEnumField, nskForVar, nskLabel, nskStub + TNimSymKinds* = set[TNimrodSymKind] type @@ -220,6 +222,11 @@ proc bindSym*(ident: string, rule: TBindSymRule = brClosed): PNimrodNode {. ## If ``rule == brForceOpen`` always an ``nkOpenSymChoice`` tree is ## returned even if the symbol is not ambiguous. +proc genSym*(kind: TNimrodSymKind = nskLet; ident = ""): PNimrodNode {. + magic: "NGenSym".} + ## generates a fresh symbol that is guaranteed to be unique. The symbol + ## needs to occur in a declaration context. + proc callsite*(): PNimrodNode {.magic: "NCallSite".} ## returns the AST if the invokation expression that invoked this macro. -- cgit 1.4.1-2-gfad0