Skip to content

Commit

Permalink
better initialization patterns for seminst (#22456)
Browse files Browse the repository at this point in the history
* better initialization patterns for seminst

* Update compiler/seminst.nim

* Update compiler/seminst.nim
  • Loading branch information
ringabout committed Aug 12, 2023
1 parent 3f7e1d7 commit 23f3f9a
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions compiler/seminst.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ proc addObjFieldsToLocalScope(c: PContext; n: PNode) =
else: discard

proc pushProcCon*(c: PContext; owner: PSym) =
var x: PProcCon
new(x)
x.owner = owner
x.next = c.p
c.p = x
c.p = PProcCon(owner: owner, next: c.p)

const
errCannotInstantiateX = "cannot instantiate: '$1'"
Expand Down Expand Up @@ -172,18 +168,13 @@ proc instGenericContainer(c: PContext, info: TLineInfo, header: PType,
allowMetaTypes = false): PType =
internalAssert c.config, header.kind == tyGenericInvocation

var
cl: TReplTypeVars = default(TReplTypeVars)
var cl: TReplTypeVars = TReplTypeVars(symMap: initIdTable(),
localCache: initIdTable(), typeMap: LayeredIdTable(),
info: info, c: c, allowMetaTypes: allowMetaTypes
)

cl.symMap = initIdTable()
cl.localCache = initIdTable()
cl.typeMap = LayeredIdTable()
cl.typeMap.topLayer = initIdTable()

cl.info = info
cl.c = c
cl.allowMetaTypes = allowMetaTypes

# We must add all generic params in scope, because the generic body
# may include tyFromExpr nodes depending on these generic params.
# XXX: This looks quite similar to the code in matchUserTypeClass,
Expand Down

0 comments on commit 23f3f9a

Please sign in to comment.