diff options
author | Araq <rumpf_a@web.de> | 2019-12-24 15:28:55 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-12-24 17:33:27 +0100 |
commit | 30162908b098d98954cd6de0da91b96f79aad3ba (patch) | |
tree | c18157551e3d2962c898357dc17ba7880d89ef87 /compiler/ccgexprs.nim | |
parent | 3516947642b57326e009a4f14c892978aa690387 (diff) | |
download | Nim-30162908b098d98954cd6de0da91b96f79aad3ba.tar.gz |
fixes another regression
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r-- | compiler/ccgexprs.nim | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 9eb42e28c..e1f4d180d 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2877,8 +2877,15 @@ proc genBracedInit(p: BProc, n: PNode; isConst: bool): Rope = of nkHiddenStdConv, nkHiddenSubConv: result = genBracedInit(p, n[1], isConst) else: - var t = skipTypes(n.typ, abstractInstOwned) - case t.kind + var ty = tyNone + if n.typ == nil: + if n.kind in nkStrKinds: + ty = tyString + else: + internalError(p.config, n.info, "node has no type") + else: + ty = skipTypes(n.typ, abstractInstOwned).kind + case ty of tySet: var cs: TBitSet toBitSet(p.config, n, cs) @@ -2889,7 +2896,7 @@ proc genBracedInit(p: BProc, n: PNode; isConst: bool): Rope = else: result = genConstSeq(p, n, n.typ, isConst) of tyProc: - if t.callConv == ccClosure and n.len > 1 and n[1].kind == nkNilLit: + if n.typ.callConv == ccClosure and n.len > 1 and n[1].kind == nkNilLit: # Conversion: nimcall -> closure. # this hack fixes issue that nkNilLit is expanded to {NIM_NIL,NIM_NIL} # this behaviour is needed since closure_var = nil must be @@ -2902,7 +2909,7 @@ proc genBracedInit(p: BProc, n: PNode; isConst: bool): Rope = else: var d: TLoc initLocExpr(p, n[0], d) - result = "{(($1) $2),NIM_NIL}" % [getClosureType(p.module, t, clHalfWithEnv), rdLoc(d)] + result = "{(($1) $2),NIM_NIL}" % [getClosureType(p.module, n.typ, clHalfWithEnv), rdLoc(d)] else: var d: TLoc initLocExpr(p, n, d) |