diff options
author | Jasper Jenkins <jasper.vs.jenkins@gmail.com> | 2019-09-05 15:56:44 -0700 |
---|---|---|
committer | Jasper Jenkins <jasper.vs.jenkins@gmail.com> | 2019-09-05 15:56:44 -0700 |
commit | 40c51751454c20f2edee34ad4ea62e12c53f7967 (patch) | |
tree | ccca22064c21112001b5ad658b275ca70f541ae7 /compiler | |
parent | 5a03eea518ba3cfeaa9f57ef0b6f1cf7bc8ed1d9 (diff) | |
download | Nim-40c51751454c20f2edee34ad4ea62e12c53f7967.tar.gz |
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) |