Fix seq.setLen initialisation in VM (#6224)
This commit is contained in:
parent
6ce6883fad
commit
0861249de7
3 changed files with 90 additions and 8 deletions
|
|
@ -2315,6 +2315,15 @@ proc genConstExpr(p: BProc, n: PNode): Rope =
|
|||
var t = skipTypes(n.typ, abstractInst)
|
||||
if t.kind == tySequence:
|
||||
result = genConstSeq(p, n, n.typ)
|
||||
elif t.kind == tyProc and t.callConv == ccClosure and not n.sons.isNil and
|
||||
n.sons[0].kind == nkNilLit and n.sons[1].kind == nkNilLit:
|
||||
# this hack fixes issue that nkNilLit is expanded to {NIM_NIL,NIM_NIL}
|
||||
# this behaviour is needed since closure_var = nil must be
|
||||
# expanded to {NIM_NIL,NIM_NIL}
|
||||
# in VM closures are initialized with nkPar(nkNilLit, nkNilLit)
|
||||
# leading to duplicate code like this:
|
||||
# "{NIM_NIL,NIM_NIL}, {NIM_NIL,NIM_NIL}"
|
||||
result = ~"{NIM_NIL,NIM_NIL}"
|
||||
else:
|
||||
result = genConstSimpleList(p, n)
|
||||
of nkObjConstr:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue