Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
still produce sym node, but give it the correct type
  • Loading branch information
metagn committed Dec 5, 2024
commit c59d95cbd2dbb7f0390e3f210763d7d6d553be6c
8 changes: 6 additions & 2 deletions compiler/vmdeps.nim
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
result = newNodeX(nkDistinctTy)
result.add mapTypeToAst(t.skipModifier, info)
else:
if allowRecursion or t.sym == nil or tfFromGeneric in t.flags:
if allowRecursion or t.sym == nil:
result = mapTypeToBracket("distinct", mDistinct, t, info)
else:
result = atomicType(t.sym)
# keep original type, t.sym can have type tyGenericBody:
result.typ() = t
of tyGenericParam, tyForward:
result = atomicType(t.sym)
of tyObject:
Expand All @@ -181,7 +183,7 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
else:
result.add newNodeI(nkEmpty, info)
else:
if allowRecursion or t.sym == nil or tfFromGeneric in t.flags:
if allowRecursion or t.sym == nil:
result = newNodeIT(nkObjectTy, if t.n.isNil: info else: t.n.info, t)
result.add newNodeI(nkEmpty, info)
if t.baseClass == nil:
Expand All @@ -191,6 +193,8 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo;
result.add copyTree(t.n)
else:
result = atomicType(t.sym)
# keep original type, t.sym can have type tyGenericBody:
result.typ() = t
of tyEnum:
result = newNodeIT(nkEnumTy, if t.n.isNil: info else: t.n.info, t)
result.add newNodeI(nkEmpty, info) # pragma node, currently always empty for enum
Expand Down
Loading