Skip to content

Commit

Permalink
revert unreleated changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bung87 committed Sep 7, 2023
1 parent 73955c0 commit bf240cf
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions compiler/ast/astalgo.nim
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,6 @@ proc listSymbolNames*(symbols: openArray[PSym]): string =
result.add sym.name.s

proc isDiscriminantField*(n: PNode): bool =
if n.kind == nkCheckedFieldExpr: n[0][1].kind == nkSym and sfDiscriminant in n[0][1].sym.flags
elif n.kind == nkDotExpr: n[1].kind == nkSym and sfDiscriminant in n[1].sym.flags
if n.kind == nkCheckedFieldExpr: sfDiscriminant in n[0][1].sym.flags
elif n.kind == nkDotExpr: sfDiscriminant in n[1].sym.flags
else: false
4 changes: 1 addition & 3 deletions compiler/sem/semexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,7 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
result = semOverloadedCallAnalyseEffects(c, n, flags)
if result == nil:
result = errorNode(c, n)
elif result.safeLen != 0:
else:
let callee = result[0].sym
if callee.magic == mNone:
semFinishOperands(c, result)
Expand All @@ -2900,8 +2900,6 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
result = fixVarArgumentsAndAnalyse(c, result)
if callee.magic != mNone:
result = magicsAfterOverloadResolution(c, result, flags)
else:
unreachable()
of mRunnableExamples:
markUsed(c, n.info, s)
if c.config.cmd in cmdDocLike and n.len >= 2 and n.lastSon.kind == nkStmtList:
Expand Down
2 changes: 1 addition & 1 deletion compiler/sem/sempass2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ proc track(tracked: PEffects, n: PNode) =
of nkVarSection, nkLetSection:
for child in n:
let last = lastSon(child)
if child.kind == nkIdentDefs and child[0].kind == nkSym and sfCompileTime in child[0].sym.flags:
if child.kind == nkIdentDefs and sfCompileTime in child[0].sym.flags:
# don't analyse the definition of ``.compileTime`` globals. They
# don't "exist" in the context (i.e., run time) we're analysing
# in
Expand Down
2 changes: 1 addition & 1 deletion compiler/tools/suggest.nim
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const
template origModuleName(m: PSym): string = m.name.s

proc findDocComment(n: PNode): PNode =
if n == nil or n.kind == nkError: return nil
if n == nil: return nil
if n.comment.len > 0: return n
if n.kind in {nkStmtList, nkStmtListExpr, nkObjectTy, nkRecList} and n.len > 0:
result = findDocComment(n[0])
Expand Down
12 changes: 5 additions & 7 deletions compiler/vm/vmjit.nim
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,13 @@ proc genProc(jit: var JitState, c: var TCtx, s: PSym): VmGenResult =
c.removeLastEof()

let body =
if isCompileTimeProc(s) and not defined(nimsuggest):
# no need to go through the transformation cache
if s.kind == skMacro:
transformBody(c.graph, c.idgen, s, s.ast[bodyPos])
else:
# watch out! Since transforming a procedure body permanently alters
# the state of inner procedures, we need to both cache and later
# retrieve the transformed body for non-compile-only routines or
# when in suggest mode
transformBody(c.graph, c.idgen, s, cache = true)
# watch out! While compile-time only procedures don't need to be cached
# here, we still need to retrieve their already cached body (if one
# exists). Lifted inner procedures would otherwise not work.
transformBody(c.graph, c.idgen, s, cache = not isCompileTimeProc(s))

echoInput(c.config, s, body)
var (tree, sourceMap) = generateCode(c.graph, s, selectOptions(c), body)
Expand Down

0 comments on commit bf240cf

Please sign in to comment.