(cherry picked from commit 6a37c0682a)
This commit is contained in:
flywind
2020-11-23 04:01:17 +08:00
committed by narimiran
parent e6ea779b06
commit fbb58343d9

View File

@@ -1805,6 +1805,7 @@ proc toVar*(typ: PType; kind: TTypeKind): PType =
proc toRef*(typ: PType): PType =
## If ``typ`` is a tyObject then it is converted into a `ref <typ>` and
## returned. Otherwise ``typ`` is simply returned as-is.
result = typ
if typ.skipTypes({tyAlias, tyGenericInst}).kind == tyObject:
result = newType(tyRef, typ.owner)
rawAddSon(result, typ)