hotfix: discriminants can be of size 8 bytes [backport]

(cherry picked from commit 24106ade8f)
This commit is contained in:
Araq
2018-12-05 09:43:34 +01:00
committed by narimiran
parent c0e741778f
commit f0a78b8ef1
2 changed files with 2 additions and 0 deletions

View File

@@ -108,6 +108,7 @@ proc getDiscriminant(aa: pointer, n: ptr TNimNode): int =
of 1: d = ze(cast[ptr int8](a +% n.offset)[])
of 2: d = ze(cast[ptr int16](a +% n.offset)[])
of 4: d = int(cast[ptr int32](a +% n.offset)[])
of 8: d = int(cast[ptr int64](a +% n.offset)[])
else: assert(false)
return d

View File

@@ -3408,6 +3408,7 @@ when not defined(JS): #and not defined(nimscript):
of 1: d = ze(cast[ptr int8](a +% n.offset)[])
of 2: d = ze(cast[ptr int16](a +% n.offset)[])
of 4: d = int(cast[ptr int32](a +% n.offset)[])
of 8: d = int(cast[ptr int64](a +% n.offset)[])
else: sysAssert(false, "getDiscriminant: invalid n.typ.size")
return d