fixes tcompiletimerange [bugfix] (#11720)
This commit is contained in:
parent
38b836b49e
commit
2895ad70c8
3 changed files with 29 additions and 7 deletions
|
|
@ -667,6 +667,22 @@ proc replaceTypesForLambda*(p: PContext, pt: TIdTable, n: PNode;
|
|||
result = replaceTypeVarsN(cl, n)
|
||||
popInfoContext(p.config)
|
||||
|
||||
proc recomputeFieldPositions*(t: PType; obj: PNode; currPosition: var int) =
|
||||
if t != nil and t.len > 0 and t.sons[0] != nil:
|
||||
let b = skipTypes(t.sons[0], skipPtrs)
|
||||
recomputeFieldPositions(b, b.n, currPosition)
|
||||
case obj.kind
|
||||
of nkRecList:
|
||||
for i in 0 ..< sonsLen(obj): recomputeFieldPositions(nil, obj.sons[i], currPosition)
|
||||
of nkRecCase:
|
||||
recomputeFieldPositions(nil, obj.sons[0], currPosition)
|
||||
for i in 1 ..< sonsLen(obj):
|
||||
recomputeFieldPositions(nil, lastSon(obj.sons[i]), currPosition)
|
||||
of nkSym:
|
||||
obj.sym.position = currPosition
|
||||
inc currPosition
|
||||
else: discard "cannot happen"
|
||||
|
||||
proc generateTypeInstance*(p: PContext, pt: TIdTable, info: TLineInfo,
|
||||
t: PType): PType =
|
||||
var typeMap = initLayeredTypeMap(pt)
|
||||
|
|
@ -674,6 +690,10 @@ proc generateTypeInstance*(p: PContext, pt: TIdTable, info: TLineInfo,
|
|||
pushInfoContext(p.config, info)
|
||||
result = replaceTypeVarsT(cl, t)
|
||||
popInfoContext(p.config)
|
||||
let objType = result.skipTypes(abstractInst)
|
||||
if objType.kind == tyObject:
|
||||
var position = 0
|
||||
recomputeFieldPositions(objType, objType.n, position)
|
||||
|
||||
proc prepareMetatypeForSigmatch*(p: PContext, pt: TIdTable, info: TLineInfo,
|
||||
t: PType): PType =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue