aboutsummaryrefslogtreecommitdiff
path: root/src/common.nim
diff options
context:
space:
mode:
authorBenjamin Shirley-Quirk2020-08-04 21:15:13 +0000
committerBenjamin Shirley-Quirk2020-08-04 21:15:13 +0000
commitb47df19c354e6b1c3c438b57eb463bbfaa8fd08d (patch)
tree9edb0f946abab16fbeac1b047a59d8a8a262cbab /src/common.nim
parent0afaa2a8cd7e56f4eabcf6b54e83bcab6be39f42 (diff)
compiles on 1.2.6
Diffstat (limited to 'src/common.nim')
-rw-r--r--src/common.nim18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/common.nim b/src/common.nim
index 58d4d08..a7d59c4 100644
--- a/src/common.nim
+++ b/src/common.nim
@@ -262,7 +262,7 @@ proc queryUnrequired*(handle: ptr AlpmHandle, withOptional: bool, withoutOptiona
check: HashSet[string]): HashSet[string] =
let full = results + check
- when NimVersion >= "1.2":
+ when NimVersion >= "1.3.5":
let direct = collect(newSeq):
for y in dependsTable.namedPairs:
if y.key in check:
@@ -274,6 +274,22 @@ proc queryUnrequired*(handle: ptr AlpmHandle, withOptional: bool, withoutOptiona
for x in providedBy:
if y.isProvidedBy(x.reference, true):
{x.name}
+ elif NimVersion >= "1.2":
+ let direct = block:
+ var tmp = newSeq[PackageReference]()
+ for y in dependsTable.namedPairs:
+ if y.key in check:
+ for x in y.value:
+ if withOptional or not x.optional:
+ tmp.add(x.reference)
+ tmp
+ let indirect = block:
+ var tmp = initHashSet[string]()
+ for y in direct:
+ for x in providedBy:
+ if y.isProvidedBy(x.reference, true):
+ tmp.incl(x.name)
+ tmp
else:
let direct = lc[x.reference | (y <- dependsTable.namedPairs, y.key in check,
x <- y.value, withOptional or not x.optional), PackageReference]