diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-12-21 17:05:21 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-22 02:05:21 +0100 |
commit | bc84d9c8cbaf4700e7c984a50876553ec21168b0 (patch) | |
tree | 0b463ebdec4657bc1ca52d4cf6407a60c9016165 /compiler | |
parent | 297c8e403d110dd872e070563328f4e0c734cd01 (diff) | |
download | Nim-bc84d9c8cbaf4700e7c984a50876553ec21168b0.tar.gz |
[backport => 1.0] fix #16428 vmops now works for generic procs (#16429)
* fix #16428 vmops now works for generic procs * remove duplication
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/vmgen.nim | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 9086b17d9..2fbb78c8f 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -1958,14 +1958,6 @@ proc matches(s: PSym; x: string): bool = for i in 1..y.len: if s == nil or (y[^i].cmpIgnoreStyle(s.name.s) != 0 and y[^i] != "*"): return false - s = s.owner - result = true - -proc matches(s: PSym; y: varargs[string]): bool = - var s = s - for i in 1..y.len: - if s == nil or (y[^i].cmpIgnoreStyle(s.name.s) != 0 and y[^i] != "*"): - return false s = if sfFromGeneric in s.flags: s.owner.owner else: s.owner result = true @@ -2024,11 +2016,11 @@ proc gen(c: PCtx; n: PNode; dest: var TDest; flags: TGenFlags = {}) = elif s.kind == skMethod: localError(c.config, n.info, "cannot call method " & s.name.s & " at compile time") - elif matches(s, "stdlib", "marshal", "to"): + elif matches(s, "stdlib.marshal.to"): # XXX marshal load&store should not be opcodes, but use the # general callback mechanisms. genMarshalLoad(c, n, dest) - elif matches(s, "stdlib", "marshal", "$$"): + elif matches(s, "stdlib.marshal.$$"): genMarshalStore(c, n, dest) else: genCall(c, n, dest) |