Fixes #3691.
This commit is contained in:
parent
e8c46d29cd
commit
3cbfd56e1d
4 changed files with 41 additions and 19 deletions
|
|
@ -1585,12 +1585,21 @@ proc skipStmtList*(n: PNode): PNode =
|
|||
result = n
|
||||
|
||||
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.kind == tyObject:
|
||||
# Convert to a `ref T`.
|
||||
result = newType(tyRef, typ.owner)
|
||||
rawAddSon(result, typ)
|
||||
|
||||
proc toObject*(typ: PType): PType =
|
||||
## If ``typ`` is a tyRef then its immediate son is returned (which in many
|
||||
## cases should be a ``tyObject``).
|
||||
## Otherwise ``typ`` is simply returned as-is.
|
||||
result = typ
|
||||
if result.kind == tyRef:
|
||||
result = result.sons[0]
|
||||
|
||||
when false:
|
||||
proc containsNil*(n: PNode): bool =
|
||||
# only for debugging
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue