Skip to content

Commit

Permalink
compatible fixes for Nim devel version
Browse files Browse the repository at this point in the history
  • Loading branch information
ba0f3 committed Jul 25, 2018
1 parent 63a91ab commit e498592
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions struct.nim
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,14 @@ proc add*(s: var Struct, d: float) {.inline.} =
proc add*(s: var Struct, str: string) {.inline.} =
s.vars.add(newStructString(str))

macro pack_m(n: openarray[expr]): stmt =
macro pack_m(n: openarray[typed]): untyped =
result = newNimNode(nnkStmtList, n)
result.add(newCall("initStruct", ident("s"), n[0]))
if n.len > 1:
for i in 1..n.len-1:
result.add(newCall(ident("add"), ident("s"), n[i]))

template `pack`*(n: varargs[expr]): expr =
template `pack`*(n: varargs[typed]): untyped =
when not declaredInScope(s):
var s {.inject.}: Struct
pack_m(n)
Expand Down
2 changes: 1 addition & 1 deletion struct.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Package]
name = "struct"
version = "0.1.1"
version = "0.1.2"
author = "Huy Doan"
description = "Python-like 'struct' for Nim"
license = "MIT"
Expand Down

0 comments on commit e498592

Please sign in to comment.