Skip to content

Commit ec1dd83

Browse files
authored
Merge pull request #4 from aguspiza/fix-nim-020
fix case warning with nim 0.20.0+
2 parents e498592 + 2923276 commit ec1dd83

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

struct.nim

+6-15
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,16 @@ proc getSize(t: char): int {.noSideEffect, inline.} =
5858
of 'q', 'Q', 'd': 8
5959
else: 0
6060

61-
proc newStructChar*(c: char): StructNode =
62-
result.kind = StructChar
63-
result.ch = c
61+
proc newStructChar*(c: char): StructNode = StructNode(kind: StructChar, ch: c)
6462

65-
proc newStructBool*(b: bool): StructNode =
66-
result.kind = StructBool
67-
result.bval = b
63+
proc newStructBool*(b: bool): StructNode = StructNode(kind: StructBool, bval: b)
6864

69-
proc newStructInt*[T: uint|int|int16|uint16|int32|uint32|int64|uint64|BiggestInt](i: T): StructNode =
70-
result.kind = StructInt
71-
result.num = i.BiggestInt
65+
proc newStructInt*[T: uint|int|int16|uint16|int32|uint32|int64|uint64|BiggestInt](i: T): StructNode =
66+
result = StructNode(kind: StructInt, num: i.BiggestInt)
7267

73-
proc newStructFloat*(d: BiggestFloat): StructNode =
74-
result.kind = StructFloat
75-
result.fval = d
68+
proc newStructFloat*(d: BiggestFloat): StructNode = StructNode(kind: StructFloat, fval: d)
7669

77-
proc newStructString*(s: string): StructNode =
78-
result.kind = StructString
79-
result.str = s
70+
proc newStructString*(s: string): StructNode = StructNode(kind: StructString, str: s)
8071

8172
proc newStructContext(): StructContext =
8273
result.byteOrder = system.cpuEndian

0 commit comments

Comments
 (0)