Alternative fix for the Nimble binary-only package problem

This commit is contained in:
Zahary Karadjov 2018-12-27 00:00:41 +02:00
parent 1d721f4eca
commit 8114c9fe1e
2 changed files with 4 additions and 5 deletions

View File

@ -6,9 +6,8 @@ author = "Status Research & Development GmbH"
description = "RLP serialization library for Nim"
license = "Apache License 2.0"
skipDirs = @["tests"]
installDirs = @["rlp"]
bin = @["rlp/bin/rlp_inspect"]
# avoid being considered a binary-only package: https://github.com/nim-lang/nimble/blob/66d79bf9a0970542351988fa31f487a1e70144f7/src/nimblepkg/packageparser.nim#L280
installExt = @["nim"]
requires "nim >= 0.17.0",
"ranges"

View File

@ -241,14 +241,14 @@ proc appendImpl(self; data: tuple) {.inline.} =
# We define a single `append` template with a pretty low specifity
# score in order to facilitate easier overloading with user types:
template append*[T](self; data: T) =
template append*[T](w: var RlpWriter; data: T) =
when data is float64:
# XXX: This works around an overloading bug.
# Apparently, integer literals will be converted to `float64`
# values with higher precedence than the generic match to Integer
appendFloat(self, data)
appendFloat(w, data)
else:
appendImpl(self, data)
appendImpl(w, data)
proc initRlpList*(listSize: int): RlpWriter =
result = initRlpWriter()