* fix #16110

* refs #16110

* fix comment

* Trigger build

* use shallowCopy for efficiency
This commit is contained in:
cooldome 2020-11-26 13:44:06 +00:00 • committed by GitHub
commit 2f1a9eadd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 8 deletions

View file

@ -1278,8 +1278,17 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) =
incl st.flags, tfRefsAnonObj
let obj = newSym(skType, getIdent(c.cache, s.name.s & ":ObjectType"),
nextId c.idgen, getCurrOwner(c), s.info)
obj.ast = a.copyTree
obj.ast[0] = newSymNode(obj)
let symNode = newSymNode(obj)
obj.ast = a.shallowCopy
case a[0].kind
of nkSym: obj.ast[0] = symNode
of nkPragmaExpr:
obj.ast[0] = a[0].shallowCopy
obj.ast[0][0] = symNode
obj.ast[0][1] = a[0][1]
else: assert(false)
obj.ast[1] = a[1]
obj.ast[2] = a[2][0]
if sfPure in s.flags:
obj.flags.incl sfPure
obj.typ = st.lastSon