Skip to content

Commit

Permalink
0.4.4: fix declaration order
Browse files Browse the repository at this point in the history
  • Loading branch information
disruptek committed Dec 14, 2020
1 parent 10f630b commit 46ae075
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions frosty.nim
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,6 @@ macro read(s: var Serializer; o: var typed) =
# a naive read of any other arbitrary type
result = newCall(bindSym"readPrimitive", s, o)

proc readTuple[S, T](s: var Serializer[S]; o: var T; skip = "") =
var skipped = skip == ""
s.debung $typeof(o)
s.greatenIndent:
for k, val in fieldPairs(o):
if not skipped and k == skip:
skipped = true
else:
when defined(frostyDebug):
s.debung k & ": " & $typeof(val)
# create a var that we can pass to the read()
var x: typeof(val)
s.read x
val = x

template greatenIndent(s: var Serializer; body: untyped): untyped =
## Used for debugging.
when frostyDebug:
Expand Down Expand Up @@ -256,6 +241,21 @@ template audit(o: typed; g: typed) =
# else, save it
g.h = h

proc readTuple[S, T](s: var Serializer[S]; o: var T; skip = "") =
var skipped = skip == ""
s.debung $typeof(o)
s.greatenIndent:
for k, val in fieldPairs(o):
if not skipped and k == skip:
skipped = true
else:
when defined(frostyDebug):
s.debung k & ": " & $typeof(val)
# create a var that we can pass to the read()
var x: typeof(val)
s.read x
val = x

proc writeString[T](s: var Serializer[Stream]; o: T) =
write(s.stream, len(o)) # put the str len
write(s.stream, o) # put the str data
Expand Down
2 changes: 1 addition & 1 deletion frosty.nimble
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "0.4.3"
version = "0.4.4"
author = "disruptek"
description = "serialize native Nim types to strings, streams, or sockets"
license = "MIT"
Expand Down

0 comments on commit 46ae075

Please sign in to comment.