diff --git a/compiler/ast.nim b/compiler/ast.nim index 2a5f18809e..594d644831 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -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 diff --git a/compiler/evaltempl.nim b/compiler/evaltempl.nim index 1b090a6d71..ff5c311549 100644 --- a/compiler/evaltempl.nim +++ b/compiler/evaltempl.nim @@ -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 diff --git a/compiler/trees.nim b/compiler/trees.nim index 05c0605953..b6d2b3461c 100644 --- a/compiler/trees.nim +++ b/compiler/trees.nim @@ -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) diff --git a/compiler/wordrecg.nim b/compiler/wordrecg.nim index 8763a52501..21b0970753 100644 --- a/compiler/wordrecg.nim +++ b/compiler/wordrecg.nim @@ -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",