diff options
author | def <dennis@felsin9.de> | 2014-08-15 19:06:13 +0200 |
---|---|---|
committer | def <dennis@felsin9.de> | 2014-08-15 19:06:13 +0200 |
commit | 7a5a6ec5bc763eea2d6ec4b18028f22527da637c (patch) | |
tree | fa4afd90f38c1118463d0e84d46c779ad3e021a7 | |
parent | ae681be62918ea1e766b230e2d098177794469e9 (diff) | |
download | Nim-7a5a6ec5bc763eea2d6ec4b18028f22527da637c.tar.gz |
Fix array address on nkHiddenAddr
-rw-r--r-- | compiler/jsgen.nim | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index 96d8b3d11..cd17202e8 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -881,14 +881,15 @@ proc genArrayAddr(p: PProc, n: PNode, r: var TCompRes) = a, b: TCompRes first: BiggestInt r.typ = etyBaseIndex - gen(p, n.sons[0], a) - gen(p, n.sons[1], b) + let m = if n.kind == nkHiddenAddr: n.sons[0] else: n + gen(p, m.sons[0], a) + gen(p, m.sons[1], b) internalAssert a.typ != etyBaseIndex and b.typ != etyBaseIndex r.address = a.res - var typ = skipTypes(n.sons[0].typ, abstractPtrs) + var typ = skipTypes(m.sons[0].typ, abstractPtrs) if typ.kind in {tyArray, tyArrayConstr}: first = firstOrd(typ.sons[0]) else: first = 0 - if optBoundsCheck in p.options and not isConstExpr(n.sons[1]): + if optBoundsCheck in p.options and not isConstExpr(m.sons[1]): useMagic(p, "chckIndx") r.res = ropef("chckIndx($1, $2, $3.length)-$2", [b.res, toRope(first), a.res]) |