.n.isNil checks for tyTuple PTypes.
This commit is contained in:
parent
dba25d2622
commit
7527da7043
4 changed files with 5 additions and 2 deletions
|
|
@ -164,6 +164,7 @@ proc packObject(x: PNode, typ: PType, res: pointer) =
|
||||||
let field = getField(typ.n, i)
|
let field = getField(typ.n, i)
|
||||||
pack(it, field.typ, res +! field.offset)
|
pack(it, field.typ, res +! field.offset)
|
||||||
else:
|
else:
|
||||||
|
# XXX: todo
|
||||||
globalError(x.info, "cannot pack unnamed tuple")
|
globalError(x.info, "cannot pack unnamed tuple")
|
||||||
|
|
||||||
const maxPackDepth = 20
|
const maxPackDepth = 20
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ proc guardDotAccess(a: PEffects; n: PNode) =
|
||||||
if g.kind == skUnknown:
|
if g.kind == skUnknown:
|
||||||
var field: PSym = nil
|
var field: PSym = nil
|
||||||
var ty = n.sons[0].typ.skipTypes(abstractPtrs)
|
var ty = n.sons[0].typ.skipTypes(abstractPtrs)
|
||||||
if ty.kind == tyTuple:
|
if ty.kind == tyTuple and not ty.n.isNil:
|
||||||
field = lookupInRecord(ty.n, g.name)
|
field = lookupInRecord(ty.n, g.name)
|
||||||
else:
|
else:
|
||||||
while ty != nil and ty.kind == tyObject:
|
while ty != nil and ty.kind == tyObject:
|
||||||
|
|
|
||||||
|
|
@ -692,7 +692,7 @@ proc typeSectionFinalPass(c: PContext, n: PNode) =
|
||||||
assignType(s.typ, t)
|
assignType(s.typ, t)
|
||||||
s.typ.id = t.id # same id
|
s.typ.id = t.id # same id
|
||||||
checkConstructedType(s.info, s.typ)
|
checkConstructedType(s.info, s.typ)
|
||||||
if s.typ.kind in {tyObject, tyTuple}:
|
if s.typ.kind in {tyObject, tyTuple} and not s.typ.n.isNil:
|
||||||
checkForMetaFields(s.typ.n)
|
checkForMetaFields(s.typ.n)
|
||||||
let aa = a.sons[2]
|
let aa = a.sons[2]
|
||||||
if aa.kind in {nkRefTy, nkPtrTy} and aa.len == 1 and
|
if aa.kind in {nkRefTy, nkPtrTy} and aa.len == 1 and
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,8 @@ proc skipIntLiteralParams*(t: PType) =
|
||||||
proc propagateFieldFlags(t: PType, n: PNode) =
|
proc propagateFieldFlags(t: PType, n: PNode) =
|
||||||
# This is meant for objects and tuples
|
# This is meant for objects and tuples
|
||||||
# The type must be fully instantiated!
|
# The type must be fully instantiated!
|
||||||
|
if n.isNil:
|
||||||
|
return
|
||||||
internalAssert n.kind != nkRecWhen
|
internalAssert n.kind != nkRecWhen
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkSym:
|
of nkSym:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue