Do not allow self import
This commit is contained in:
parent
b7befd69ba
commit
849484f920
1 changed files with 4 additions and 2 deletions
|
|
@ -159,6 +159,8 @@ proc myImportModule(c: PContext, n: PNode): PSym =
|
|||
var f = checkModuleName(n)
|
||||
if f != InvalidFileIDX:
|
||||
result = importModuleAs(n, gImportModule(c.module, f))
|
||||
if result.name.s == fileInfos[n.info.fileIndex].shortName:
|
||||
localError(n.info, errGenerated, "A module cannot import itself")
|
||||
if sfDeprecated in result.flags:
|
||||
message(n.info, warnDeprecated, result.name.s)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue