diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-09-08 23:09:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-08 23:09:41 +0200 |
commit | aa95ae6af93e04c5465d76347ab2150bf13d9669 (patch) | |
tree | d03d6ace2d7ad094bc80a310a124c412833aee16 /compiler | |
parent | f915064e07c31b0be88bb39553764dd9f1c6c915 (diff) | |
parent | 40c51751454c20f2edee34ad4ea62e12c53f7967 (diff) | |
download | Nim-aa95ae6af93e04c5465d76347ab2150bf13d9669.tar.gz |
Merge pull request #12153 from dumjyl/get_type-range
fix range.getType crash
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/vmdeps.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/vmdeps.nim b/compiler/vmdeps.nim index 1b2538c79..e3d9533aa 100644 --- a/compiler/vmdeps.nim +++ b/compiler/vmdeps.nim @@ -242,7 +242,7 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo; of tyRange: result = newNodeIT(nkBracketExpr, if t.n.isNil: info else: t.n.info, t) result.add atomicType("range", mRange) - if inst: + if inst and t.n.len == 2: let rng = newNodeX(nkInfix) rng.add newIdentNode(getIdent(cache, ".."), info) rng.add t.n.sons[0].copyTree @@ -250,7 +250,8 @@ proc mapTypeToAstX(cache: IdentCache; t: PType; info: TLineInfo; result.add rng else: result.add t.n.sons[0].copyTree - result.add t.n.sons[1].copyTree + if t.n.len > 1: + result.add t.n.sons[1].copyTree of tyPointer: result = atomicType("pointer", mPointer) of tyString: result = atomicType("string", mString) of tyCString: result = atomicType("cstring", mCstring) |