refactor illegal iterator assignment detection (#12212)

* refactor illegal iterator assignment detection

* delete crappy test
This commit is contained in:
Arne Döring 2019-10-11 08:43:58 +02:00 • committed by Andreas Rumpf
commit 7cf3395d85
9 changed files with 54 additions and 54 deletions

View file

@ -1810,11 +1810,11 @@ template getBody*(s: PSym): PNode = s.ast[bodyPos]
template detailedInfo*(sym: PSym): string =
sym.name.s
proc isInlineIterator*(s: PSym): bool {.inline.} =
s.kind == skIterator and s.typ.callConv != ccClosure
proc isInlineIterator*(typ: PType): bool {.inline.} =
typ.kind == tyProc and tfIterator in typ.flags and typ.callConv != ccClosure
proc isClosureIterator*(s: PSym): bool {.inline.} =
s.kind == skIterator and s.typ.callConv == ccClosure
proc isClosureIterator*(typ: PType): bool {.inline.} =
typ.kind == tyProc and tfIterator in typ.flags and typ.callConv == ccClosure
proc isSinkParam*(s: PSym): bool {.inline.} =
s.kind == skParam and (s.typ.kind == tySink or tfHasOwned in s.typ.flags)