'var T' for iterators
This commit is contained in:
parent
4f7fa05911
commit
3e806a374a
7 changed files with 79 additions and 11 deletions
|
|
@ -502,9 +502,15 @@ proc transformFor(c: PTransf, n: PNode): PTransNode =
|
|||
addVar(v, newSymNode(temp))
|
||||
add(result, newAsgnStmt(c, newSymNode(temp), arg.ptransNode))
|
||||
IdNodeTablePut(newC.mapping, formal, newSymNode(temp))
|
||||
of paVarAsgn:
|
||||
of paVarAsgn:
|
||||
assert(skipTypes(formal.typ, abstractInst).kind == tyVar)
|
||||
InternalError(arg.info, "not implemented: pass to var parameter")
|
||||
# XXX why is this even necessary?
|
||||
var b = newNodeIT(nkHiddenAddr, arg.info, formal.typ)
|
||||
b.add(arg)
|
||||
arg = b
|
||||
IdNodeTablePut(newC.mapping, formal, arg)
|
||||
# XXX BUG still not correct if the arg has a side effect!
|
||||
#InternalError(arg.info, "not implemented: pass to var parameter")
|
||||
var body = newC.owner.ast.sons[codePos]
|
||||
pushInfoContext(n.info)
|
||||
inc(c.inlining)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue