diff options
Diffstat (limited to 'compiler/treetab.nim')
-rw-r--r-- | compiler/treetab.nim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/treetab.nim b/compiler/treetab.nim index 82df4cece..31cc76366 100644 --- a/compiler/treetab.nim +++ b/compiler/treetab.nim @@ -12,8 +12,9 @@ import hashes, ast, astalgo, types -proc hashTree(n: PNode): Hash = - if n == nil: return +proc hashTree*(n: PNode): Hash = + if n.isNil: + return result = ord(n.kind) case n.kind of nkEmpty, nkNilLit, nkType: @@ -21,7 +22,7 @@ proc hashTree(n: PNode): Hash = of nkIdent: result = result !& n.ident.h of nkSym: - result = result !& n.sym.name.h + result = result !& n.sym.id of nkCharLit..nkUInt64Lit: if (n.intVal >= low(int)) and (n.intVal <= high(int)): result = result !& int(n.intVal) @@ -33,6 +34,9 @@ proc hashTree(n: PNode): Hash = else: for i in 0..<n.len: result = result !& hashTree(n[i]) + result = !$result + #echo "hashTree ", result + #echo n proc treesEquivalent(a, b: PNode): bool = if a == b: |