fixes view types for sizeof() and --gc:orc (#15680)
This commit is contained in:
parent
8358974b73
commit
64016ddedc
3 changed files with 5 additions and 5 deletions
|
|
@ -2328,10 +2328,10 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
|
||||||
of mNewSeqOfCap: genNewSeqOfCap(p, e, d)
|
of mNewSeqOfCap: genNewSeqOfCap(p, e, d)
|
||||||
of mSizeOf:
|
of mSizeOf:
|
||||||
let t = e[1].typ.skipTypes({tyTypeDesc})
|
let t = e[1].typ.skipTypes({tyTypeDesc})
|
||||||
putIntoDest(p, d, e, "((NI)sizeof($1))" % [getTypeDesc(p.module, t)])
|
putIntoDest(p, d, e, "((NI)sizeof($1))" % [getTypeDesc(p.module, t, skVar)])
|
||||||
of mAlignOf:
|
of mAlignOf:
|
||||||
let t = e[1].typ.skipTypes({tyTypeDesc})
|
let t = e[1].typ.skipTypes({tyTypeDesc})
|
||||||
putIntoDest(p, d, e, "((NI)NIM_ALIGNOF($1))" % [getTypeDesc(p.module, t)])
|
putIntoDest(p, d, e, "((NI)NIM_ALIGNOF($1))" % [getTypeDesc(p.module, t, skVar)])
|
||||||
of mOffsetOf:
|
of mOffsetOf:
|
||||||
var dotExpr: PNode
|
var dotExpr: PNode
|
||||||
if e[1].kind == nkDotExpr:
|
if e[1].kind == nkDotExpr:
|
||||||
|
|
@ -2341,7 +2341,7 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
|
||||||
else:
|
else:
|
||||||
internalError(p.config, e.info, "unknown ast")
|
internalError(p.config, e.info, "unknown ast")
|
||||||
let t = dotExpr[0].typ.skipTypes({tyTypeDesc})
|
let t = dotExpr[0].typ.skipTypes({tyTypeDesc})
|
||||||
let tname = getTypeDesc(p.module, t)
|
let tname = getTypeDesc(p.module, t, skVar)
|
||||||
let member =
|
let member =
|
||||||
if t.kind == tyTuple:
|
if t.kind == tyTuple:
|
||||||
"Field" & rope(dotExpr[1].sym.position)
|
"Field" & rope(dotExpr[1].sym.position)
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ proc computeSizeAlign(conf: ConfigRef; typ: PType) =
|
||||||
else:
|
else:
|
||||||
typ.size = conf.target.ptrSize
|
typ.size = conf.target.ptrSize
|
||||||
typ.align = int16(conf.target.ptrSize)
|
typ.align = int16(conf.target.ptrSize)
|
||||||
of tyCString, tySequence, tyPtr, tyRef, tyVar, tyLent, tyOpenArray:
|
of tyCString, tySequence, tyPtr, tyRef, tyVar, tyLent:
|
||||||
let base = typ.lastSon
|
let base = typ.lastSon
|
||||||
if base == typ:
|
if base == typ:
|
||||||
# this is not the correct location to detect ``type A = ptr A``
|
# this is not the correct location to detect ``type A = ptr A``
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ asdf
|
||||||
231
|
231
|
||||||
231
|
231
|
||||||
'''
|
'''
|
||||||
cmd: "nim c $file"
|
cmd: "nim c --gc:orc $file"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
{.experimental: "views".}
|
{.experimental: "views".}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue