make tsigbreak.nim compile
This commit is contained in:
parent
34143ee122
commit
e169eaac5b
4 changed files with 42 additions and 7 deletions
|
|
@ -444,7 +444,7 @@ type
|
|||
nfPreventCg # this node should be ignored by the codegen
|
||||
|
||||
TNodeFlags* = set[TNodeFlag]
|
||||
TTypeFlag* = enum # keep below 32 for efficiency reasons (now: 28)
|
||||
TTypeFlag* = enum # keep below 32 for efficiency reasons (now: 30)
|
||||
tfVarargs, # procedure has C styled varargs
|
||||
tfNoSideEffect, # procedure type does not allow side effects
|
||||
tfFinal, # is the object final?
|
||||
|
|
@ -488,6 +488,7 @@ type
|
|||
tfBorrowDot # distinct type borrows '.'
|
||||
tfTriggersCompileTime # uses the NimNode type which make the proc
|
||||
# implicitly '.compiletime'
|
||||
tfRefsAnonObj # used for 'ref object' and 'ptr object'
|
||||
|
||||
TTypeFlags* = set[TTypeFlag]
|
||||
|
||||
|
|
|
|||
|
|
@ -759,9 +759,11 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) =
|
|||
if st.kind == tyGenericBody: st = st.lastSon
|
||||
internalAssert st.kind in {tyPtr, tyRef}
|
||||
internalAssert st.lastSon.sym == nil
|
||||
incl st.flags, tfRefsAnonObj
|
||||
st.lastSon.sym = newSym(skType, getIdent(s.name.s & ":ObjectType"),
|
||||
getCurrOwner(), s.info)
|
||||
|
||||
|
||||
proc checkForMetaFields(n: PNode) =
|
||||
template checkMeta(t) =
|
||||
if t != nil and t.isMetaType and tfGenericTypeParam notin t.flags:
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
|
|||
|
||||
let bbody = lastSon body
|
||||
var newbody = replaceTypeVarsT(cl, bbody)
|
||||
let bodyIsNew = newbody != bbody
|
||||
cl.skipTypedesc = oldSkipTypedesc
|
||||
newbody.flags = newbody.flags + (t.flags + body.flags - tfInstClearedFlags)
|
||||
result.flags = result.flags + newbody.flags - tfInstClearedFlags
|
||||
|
|
@ -310,9 +311,13 @@ proc handleGenericInvocation(cl: var TReplTypeVars, t: PType): PType =
|
|||
# generics *when the type is constructed*:
|
||||
newbody.deepCopy = cl.c.instTypeBoundOp(cl.c, dc, result, cl.info,
|
||||
attachedDeepCopy, 1)
|
||||
newbody.typeInst = result
|
||||
if newbody.kind == tyRef:
|
||||
newbody.lastSon.typeInst = result
|
||||
if bodyIsNew and newbody.typeInst == nil:
|
||||
#doassert newbody.typeInst == nil
|
||||
newbody.typeInst = result
|
||||
if tfRefsAnonObj in newbody.flags:
|
||||
assert newbody.kind in {tyRef, tyPtr}
|
||||
assert newbody.lastSon.typeInst == nil
|
||||
newbody.lastSon.typeInst = result
|
||||
let asgn = newbody.assignment
|
||||
if asgn != nil and sfFromGeneric notin asgn.flags:
|
||||
# '=' needs to be instantiated for generics when the type is constructed:
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ type
|
|||
ConsiderFlag* = enum
|
||||
CoProc
|
||||
CoType
|
||||
CoNoGeneric
|
||||
|
||||
proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
||||
if t == nil:
|
||||
|
|
@ -153,10 +152,10 @@ proc hashType(c: var MD5Context, t: PType; flags: set[ConsiderFlag]) =
|
|||
if t.sym != nil and {sfImportc, sfExportc} * t.sym.flags != {}:
|
||||
c.hashSym(t.sym)
|
||||
of tyObject, tyEnum:
|
||||
if t.typeInst != nil and CoNoGeneric notin flags:
|
||||
if t.typeInst != nil:
|
||||
assert t.typeInst.kind == tyGenericInst
|
||||
for i in countup(1, sonsLen(t.typeInst) - 2):
|
||||
c.hashType t.typeInst.sons[i], flags+{CoNoGeneric}
|
||||
c.hashType t.typeInst.sons[i], flags
|
||||
# Every cyclic type in Nim need to be constructed via some 't.sym', so this
|
||||
# is actually safe without an infinite recursion check:
|
||||
if t.sym != nil:
|
||||
|
|
|
|||
Loading…
Reference in a new issue