diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-01-06 18:15:08 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-01-06 18:15:08 +0100 |
commit | 64912d3d70224463ae2f5b1cc829ee1dd2442dcc (patch) | |
tree | c3a2e549793d3a001eb7232463fd5bec23e0510d | |
parent | 76bc890e36c23a6cf5ae8725fcde08fe4324d7d5 (diff) | |
download | Nim-64912d3d70224463ae2f5b1cc829ee1dd2442dcc.tar.gz |
fixes #5185
-rw-r--r-- | compiler/importer.nim | 5 | ||||
-rw-r--r-- | compiler/sem.nim | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/compiler/importer.nim b/compiler/importer.nim index 615d01693..087fd9e2b 100644 --- a/compiler/importer.nim +++ b/compiler/importer.nim @@ -49,12 +49,13 @@ proc getModuleName*(n: PNode): string = localError(n.info, errGenerated, "invalid module name: '$1'" % n.renderTree) result = "" -proc checkModuleName*(n: PNode): int32 = +proc checkModuleName*(n: PNode; doLocalError=true): int32 = # This returns the full canonical path for a given module import let modulename = n.getModuleName let fullPath = findModule(modulename, n.info.toFullPath) if fullPath.len == 0: - localError(n.info, errCannotOpenFile, modulename) + if doLocalError: + localError(n.info, errCannotOpenFile, modulename) result = InvalidFileIDX else: result = fullPath.fileInfoIdx diff --git a/compiler/sem.nim b/compiler/sem.nim index 755abec5d..d3349a750 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -440,11 +440,11 @@ proc isImportSystemStmt(n: PNode): bool = case n.kind of nkImportStmt: for x in n: - let f = checkModuleName(x) + let f = checkModuleName(x, false) if f == magicsys.systemModule.info.fileIndex: return true of nkImportExceptStmt, nkFromStmt: - let f = checkModuleName(n[0]) + let f = checkModuleName(n[0], false) if f == magicsys.systemModule.info.fileIndex: return true else: discard |