summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-08-09 16:38:10 +0200
committerAraq <rumpf_a@web.de>2019-08-09 16:38:10 +0200
commit0e4a8bfb289d707909069e72ca24efd2a074a5f1 (patch)
tree853d72108b5e6070a42460f23d4baef0ffafdb02
parentda37177ac252599c731589bf27d1e384403a047a (diff)
downloadNim-0e4a8bfb289d707909069e72ca24efd2a074a5f1.tar.gz
fixes 'unused module' feature for 32 bit builds of Nim for good [nobackport]
-rw-r--r--compiler/importer.nim4
-rw-r--r--compiler/semdata.nim6
-rw-r--r--compiler/suggest.nim4
3 files changed, 6 insertions, 8 deletions
diff --git a/compiler/importer.nim b/compiler/importer.nim
index d048d7fe1..2471f05aa 100644
--- a/compiler/importer.nim
+++ b/compiler/importer.nim
@@ -11,7 +11,7 @@
 
 import
   intsets, ast, astalgo, msgs, options, idents, lookups,
-  semdata, modulepaths, sigmatch, lineinfos
+  semdata, modulepaths, sigmatch, lineinfos, sets
 
 proc readExceptSet*(c: PContext, n: PNode): IntSet =
   assert n.kind in {nkImportExceptStmt, nkExportExceptStmt}
@@ -70,7 +70,7 @@ proc rawImportSymbol(c: PContext, s, origin: PSym) =
     if s.kind == skConverter: addConverter(c, s)
     if hasPattern(s): addPattern(c, s)
   if s.owner != origin:
-    c.exportIndirections.incl(idPairToInt(origin.id, s.id))
+    c.exportIndirections.incl((origin.id, s.id))
 
 proc importSymbol(c: PContext, n: PNode, fromMod: PSym) =
   let ident = lookups.considerQuotedIdent(c, n)
diff --git a/compiler/semdata.nim b/compiler/semdata.nim
index 7010d512a..0d4d3ea48 100644
--- a/compiler/semdata.nim
+++ b/compiler/semdata.nim
@@ -11,7 +11,7 @@
 
 import
   intsets, options, ast, astalgo, msgs, idents, renderer,
-  magicsys, vmdef, modulegraphs, lineinfos
+  magicsys, vmdef, modulegraphs, lineinfos, sets
 
 type
   TOptionEntry* = object      # entries to put on a stack for pragma parsing
@@ -138,9 +138,7 @@ type
       # tests/destructor/topttree.nim for an example that
       # would otherwise fail.
     unusedImports*: seq[(PSym, TLineInfo)]
-    exportIndirections*: IntSet
-
-template idPairToInt*(a, b: int): int = a * 1_000_000 + b
+    exportIndirections*: HashSet[(int, int)]
 
 template config*(c: PContext): ConfigRef = c.graph.config
 
diff --git a/compiler/suggest.nim b/compiler/suggest.nim
index 38ebb85e0..dc01916d1 100644
--- a/compiler/suggest.nim
+++ b/compiler/suggest.nim
@@ -32,7 +32,7 @@
 
 # included from sigmatch.nim
 
-import algorithm, prefixmatches, lineinfos, parseutils, linter
+import algorithm, sets, prefixmatches, lineinfos, parseutils, linter
 from wordrecg import wDeprecated, wError, wAddr, wYield, specialWords
 
 when defined(nimsuggest):
@@ -536,7 +536,7 @@ proc markOwnerModuleAsUsed(c: PContext; s: PSym) =
     var i = 0
     while i <= high(c.unusedImports):
       let candidate = c.unusedImports[i][0]
-      if candidate == module or c.exportIndirections.contains(idPairToInt(candidate.id, s.id)):
+      if candidate == module or c.exportIndirections.contains((candidate.id, s.id)):
         # mark it as used:
         c.unusedImports.del(i)
       else: