make case-object transitions explicit, make unknownLineInfo a const, replace a few magic numbers with consts (#13170)

This commit is contained in:
Jasper Jenkins 2020-01-17 01:34:32 -08:00 • committed by Andreas Rumpf
commit 796aafe7e0
35 changed files with 182 additions and 203 deletions

View file

@ -837,12 +837,12 @@ proc liftIterToProc*(g: ModuleGraph; fn: PSym; body: PNode; ptrType: PType): PNo
# pretend 'fn' is a closure iterator for the analysis:
let oldKind = fn.kind
let oldCC = fn.typ.callConv
fn.kind = skIterator
fn.transitionRoutineSymKind(skIterator)
fn.typ.callConv = ccClosure
d.ownerToType[fn.id] = ptrType
detectCapturedVars(body, fn, d)
result = liftCapturedVars(body, fn, d, c)
fn.kind = oldKind
fn.transitionRoutineSymKind(oldKind)
fn.typ.callConv = oldCC
proc liftLambdas*(g: ModuleGraph; fn: PSym, body: PNode; tooEarly: var bool): PNode =
@ -959,7 +959,7 @@ proc liftForLoop*(g: ModuleGraph; body: PNode; owner: PSym): PNode =
var vpart = newNodeI(if body.len == 3: nkIdentDefs else: nkVarTuple, body.info)
for i in 0..<body.len-2:
if body[i].kind == nkSym:
body[i].sym.kind = skLet
body[i].sym.transitionToLet()
vpart.add body[i]
vpart.add newNodeI(nkEmpty, body.info) # no explicit type