Compare fileIndexes instead of file names

This commit is contained in:
Simon Krauter 2014-10-15 00:20:08 +02:00
commit 27585ee6ec

View file

@ -159,7 +159,7 @@ proc myImportModule(c: PContext, n: PNode): PSym =
var f = checkModuleName(n) var f = checkModuleName(n)
if f != InvalidFileIDX: if f != InvalidFileIDX:
result = importModuleAs(n, gImportModule(c.module, f)) result = importModuleAs(n, gImportModule(c.module, f))
if result.name.s == fileInfos[n.info.fileIndex].shortName: if result.info.fileIndex == n.info.fileIndex:
localError(n.info, errGenerated, "A module cannot import itself") localError(n.info, errGenerated, "A module cannot import itself")
if sfDeprecated in result.flags: if sfDeprecated in result.flags:
message(n.info, warnDeprecated, result.name.s) message(n.info, warnDeprecated, result.name.s)