Update compile time check to use when
This commit is contained in:
parent
ae2d33aacd
commit
31ffc8992f
|
@ -35,11 +35,15 @@ func decode*[E: Event](decoder: var AbiDecoder, _: type E): ?!E =
|
||||||
success event
|
success event
|
||||||
|
|
||||||
func isSupported(T: type): bool =
|
func isSupported(T: type): bool =
|
||||||
var supported = T is ValueType or
|
var supported = false
|
||||||
T is SmallByteArray
|
# nim 1.2.x fails distinctBase checks on non-distinct types at compile time,
|
||||||
when compiles (T.distinctBase):
|
# so we must separate with `when`
|
||||||
supported = supported or T.distinctBase is ValueType or
|
when T is distinct:
|
||||||
T.distinctBase is SmallByteArray
|
supported = T.distinctBase is ValueType or
|
||||||
|
T.distinctBase is SmallByteArray
|
||||||
|
else:
|
||||||
|
supported = T is ValueType or
|
||||||
|
T is SmallByteArray
|
||||||
return supported
|
return supported
|
||||||
|
|
||||||
func decode*[E: Event](_: type E, data: seq[byte], topics: seq[Topic]): ?!E =
|
func decode*[E: Event](_: type E, data: seq[byte], topics: seq[Topic]): ?!E =
|
||||||
|
|
Loading…
Reference in New Issue