diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2018-08-16 01:22:21 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-08-16 01:22:21 +0200 |
commit | e4c759fbffae852b938a076de38ba2df4eab6afa (patch) | |
tree | f793335b31a460cae2966dd407ec934671ecc9ee /compiler/ast.nim | |
parent | b78114ce507757cd79649212bd17dc86965aa4ef (diff) | |
parent | 531c66d1ec583a35d8d6bc637c94457fcd87a8e3 (diff) | |
download | Nim-e4c759fbffae852b938a076de38ba2df4eab6afa.tar.gz |
Merge branch 'devel' into araq-misc
Diffstat (limited to 'compiler/ast.nim')
-rw-r--r-- | compiler/ast.nim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index e294eccc2..01e70ce75 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1680,6 +1680,14 @@ proc skipStmtList*(n: PNode): PNode = else: result = n +proc toVar*(typ: PType): PType = + ## If ``typ`` is not a tyVar then it is converted into a `var <typ>` and + ## returned. Otherwise ``typ`` is simply returned as-is. + result = typ + if typ.kind != tyVar: + result = newType(tyVar, typ.owner) + rawAddSon(result, typ) + 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. |