Skip to content

Commit afad3c5

Browse files
nigredo-torioprypin
authored andcommitted
Fix after changes in Nim effect tracking. (#27)
1 parent 34d42d9 commit afad3c5

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/docopt.nim

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,23 @@ type
8888

8989
{.warning[LockLevel]: off.}
9090

91-
method str(self: Pattern): string {.base.} =
91+
method str(self: Pattern): string {.base, gcsafe, nosideeffect.} =
9292
assert false
9393

94-
method name(self: Pattern): string {.base.} =
94+
method name(self: Pattern): string {.base, gcsafe.} =
9595
self.m_name
96-
method `name=`(self: Pattern, name: string) {.base.} =
96+
method `name=`(self: Pattern, name: string) {.base, gcsafe.} =
9797
self.m_name = name
9898

99-
method `==`(self, other: Pattern): bool {.base.} =
99+
method `==`(self, other: Pattern): bool {.base, gcsafe, nosideeffect.} =
100100
self.str == other.str
101101

102-
method flat(self: Pattern, types: varargs[string]): seq[Pattern] {.base.} =
102+
method flat(self: Pattern,
103+
types: varargs[string]): seq[Pattern] {.base, gcsafe.} =
103104
assert false
104105

105106
method match(self: Pattern, left: seq[Pattern],
106-
collected: seq[Pattern] = @[]): MatchResult {.base.} =
107+
collected: seq[Pattern] = @[]): MatchResult {.base, gcsafe.} =
107108
assert false
108109

109110
method fix_identities(self: Pattern, uniq: seq[Pattern]) {.base, gcsafe.} =
@@ -117,10 +118,10 @@ method fix_identities(self: Pattern, uniq: seq[Pattern]) {.base, gcsafe.} =
117118
else:
118119
child.fix_identities(uniq)
119120

120-
method fix_identities(self: Pattern) {.base.} =
121+
method fix_identities(self: Pattern) {.base, gcsafe.} =
121122
self.fix_identities(self.flat().deduplicate())
122123

123-
method either(self: Pattern): Either {.base.} =
124+
method either(self: Pattern): Either {.base, gcsafe.} =
124125
## Transform pattern into an equivalent, with only top-level Either.
125126
# Currently the pattern will not be equivalent, but more "narrow",
126127
# although good enough to reason about list arguments.
@@ -150,7 +151,7 @@ method either(self: Pattern): Either {.base.} =
150151
ret.add children
151152
either(ret.map_it(Pattern, required(it)))
152153

153-
method fix_repeating_arguments(self: Pattern) {.base.} =
154+
method fix_repeating_arguments(self: Pattern) {.base, gcsafe.} =
154155
## Fix elements that should accumulate/increment values.
155156
var either: seq[seq[Pattern]] = @[]
156157
for child in self.either.children:
@@ -169,7 +170,7 @@ method fix_repeating_arguments(self: Pattern) {.base.} =
169170
e.class == "Option" and Option(e).argcount == 0:
170171
e.value = val(0)
171172

172-
method fix(self: Pattern) {.base.} =
173+
method fix(self: Pattern) {.base, gcsafe.} =
173174
self.fix_identities()
174175
self.fix_repeating_arguments()
175176

@@ -181,7 +182,7 @@ method flat(self: ChildPattern, types: varargs[string]): seq[Pattern] =
181182
if types.len == 0 or self.class in types: @[Pattern(self)] else: @[]
182183

183184
method single_match(self: ChildPattern,
184-
left: seq[Pattern]): SingleMatchResult {.base.} =
185+
left: seq[Pattern]): SingleMatchResult {.base, gcsafe.} =
185186
assert false
186187

187188
method match(self: ChildPattern, left: seq[Pattern],
@@ -295,7 +296,6 @@ method match(self: Optional, left: seq[Pattern],
295296
result = pattern.match(result.left, result.collected)
296297
result.matched = true
297298

298-
299299
method match(self: OneOrMore, left: seq[Pattern],
300300
collected: seq[Pattern] = @[]): MatchResult =
301301
assert self.children.len == 1

src/private/util.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ macro gen_class*(body: untyped): untyped =
5858
for typ in body[0].children:
5959
var meth = "method class(self: $1): string"
6060
if $typ[2][0][1][0] == "RootObj":
61-
meth &= "{.base.}"
61+
meth &= "{.base, gcsafe.}"
6262
meth &= "= \"$1\""
6363
body.add(parse_stmt(meth.format(typ[0])))
6464
body

src/private/value.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ proc `$`*(v: Value): string =
9898
v.list_v[0]
9999
else: v.str
100100

101-
proc `==`*(a, b: Value): bool =
101+
proc `==`*(a, b: Value): bool {.gcsafe.} =
102102
a.kind == b.kind and a.str == b.str
103103

104104

0 commit comments

Comments
 (0)