compiler: minor code cleanups

This commit is contained in:
Araq 2020-07-27 08:05:52 +02:00
commit a0049d1fb0
4 changed files with 4 additions and 5 deletions

View file

@ -23,7 +23,7 @@
## do a compile-time copy-on-write analysis. ## do a compile-time copy-on-write analysis.
import import
ast, types, renderer, idents, intsets, options, msgs ast, types, renderer, idents, intsets, options
type type
Cursor = object Cursor = object

View file

@ -187,10 +187,9 @@ proc impMod(c: PContext; it: PNode; importStmtResult: PNode) =
let it = transformImportAs(c, it) let it = transformImportAs(c, it)
let m = myImportModule(c, it, importStmtResult) let m = myImportModule(c, it, importStmtResult)
if m != nil: if m != nil:
var emptySet: IntSet
# ``addDecl`` needs to be done before ``importAllSymbols``! # ``addDecl`` needs to be done before ``importAllSymbols``!
addDecl(c, m, it.info) # add symbol to symbol table of module addDecl(c, m, it.info) # add symbol to symbol table of module
importAllSymbolsExcept(c, m, emptySet) importAllSymbols(c, m)
#importForwarded(c, m.ast, emptySet, m) #importForwarded(c, m.ast, emptySet, m)
proc evalImport*(c: PContext, n: PNode): PNode = proc evalImport*(c: PContext, n: PNode): PNode =

View file

@ -11,7 +11,7 @@
## https://github.com/nim-lang/RFCs/issues/244 for more details. ## https://github.com/nim-lang/RFCs/issues/244 for more details.
import import
ast, types, renderer, idents, intsets, options, msgs ast, types, renderer, idents, intsets
proc canAlias(arg, ret: PType; marker: var IntSet): bool proc canAlias(arg, ret: PType; marker: var IntSet): bool

View file

@ -558,7 +558,7 @@ proc markUsed(c: PContext; info: TLineInfo; s: PSym) =
warnAboutDeprecated(conf, info, s) warnAboutDeprecated(conf, info, s)
if {sfDeprecated, sfError} * s.flags != {}: if {sfDeprecated, sfError} * s.flags != {}:
if sfDeprecated in s.flags: if sfDeprecated in s.flags:
if not (c.lastTLineInfo.line == info.line and if not (c.lastTLineInfo.line == info.line and
c.lastTLineInfo.col == info.col): c.lastTLineInfo.col == info.col):
warnAboutDeprecated(conf, info, s) warnAboutDeprecated(conf, info, s)
c.lastTLineInfo = info c.lastTLineInfo = info