make runnableExamples a special word (#22024)

* make runnableExamples a special word

* fix imports
This commit is contained in:
metagn
2023-06-07 00:31:55 +03:00
committed by GitHub
parent 80fc749835
commit 1dedad5620
4 changed files with 7 additions and 7 deletions

View File

@@ -1930,11 +1930,6 @@ proc isCompileTimeProc*(s: PSym): bool {.inline.} =
result = s.kind == skMacro or
s.kind in {skProc, skFunc} and sfCompileTime in s.flags
proc isRunnableExamples*(n: PNode): bool =
# Templates and generics don't perform symbol lookups.
result = n.kind == nkSym and n.sym.magic == mRunnableExamples or
n.kind == nkIdent and n.ident.s == "runnableExamples"
proc hasPattern*(s: PSym): bool {.inline.} =
result = isRoutine(s) and s.ast[patternPos].kind != nkEmpty

View File

@@ -10,7 +10,7 @@
## Template evaluation engine. Now hygienic.
import
strutils, options, ast, astalgo, msgs, renderer, lineinfos, idents
strutils, options, ast, astalgo, msgs, renderer, lineinfos, idents, trees
type
TemplCtx = object

View File

@@ -214,3 +214,8 @@ proc dontInlineConstant*(orig, cnst: PNode): bool {.inline.} =
result = orig.kind != cnst.kind and
cnst.kind in {nkCurly, nkPar, nkTupleConstr, nkBracket, nkObjConstr} and
cnst.len > ord(cnst.kind == nkObjConstr)
proc isRunnableExamples*(n: PNode): bool =
# Templates and generics don't perform symbol lookups.
result = n.kind == nkSym and n.sym.magic == mRunnableExamples or
n.kind == nkIdent and n.ident.id == ord(wRunnableExamples)

View File

@@ -37,7 +37,7 @@ type
wMemTracker = "memtracker", wObjChecks = "objchecks",
wIntDefine = "intdefine", wStrDefine = "strdefine", wBoolDefine = "booldefine",
wCursor = "cursor", wNoalias = "noalias", wEffectsOf = "effectsOf",
wUncheckedAssign = "uncheckedAssign",
wUncheckedAssign = "uncheckedAssign", wRunnableExamples = "runnableExamples",
wImmediate = "immediate", wConstructor = "constructor", wDestructor = "destructor",
wDelegator = "delegator", wOverride = "override", wImportCpp = "importcpp",