This commit is contained in:
flywind 2020-11-23 04:01:17 +08:00 • committed by GitHub
commit 6a37c0682a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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