mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-02 19:22:40 +00:00
Merge pull request #1410 from Varriount/flyx-ptables_fix
Flyx ptables fix
This commit is contained in:
@@ -246,7 +246,8 @@ template equalsImpl() =
|
||||
# different insertion orders mean different 'data' seqs, so we have
|
||||
# to use the slow route here:
|
||||
for key, val in s:
|
||||
if not hasKey(t, key): return false
|
||||
# prefix notation leads to automatic dereference in case of PTable
|
||||
if not t.hasKey(key): return false
|
||||
if t[key] != val: return false
|
||||
return true
|
||||
|
||||
@@ -332,7 +333,9 @@ proc `$`*[A, B](t: PTable[A, B]): string =
|
||||
dollarImpl()
|
||||
|
||||
proc `==`*[A, B](s, t: PTable[A, B]): bool =
|
||||
equalsImpl()
|
||||
if isNil(s): result = isNil(t)
|
||||
elif isNil(t): result = false
|
||||
else: result = equalsImpl()
|
||||
|
||||
proc newTableFrom*[A, B, C](collection: A, index: proc(x: B): C): PTable[C, B] =
|
||||
## Index the collection with the proc provided.
|
||||
|
||||
Reference in New Issue
Block a user