diff options
author | Araq <rumpf_a@web.de> | 2013-04-12 16:24:58 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-04-12 16:24:58 +0200 |
commit | 3cb3813eed378d753807a07f434234ce2d4c5159 (patch) | |
tree | 7c108fb992666e0833eb6050f53977628fa9534b /compiler/ccgexprs.nim | |
parent | f5db2de696af7e33fdcbcf96f2be577c1e9a52e2 (diff) | |
download | Nim-3cb3813eed378d753807a07f434234ce2d4c5159.tar.gz |
fixes #287; bugfix: subrange checking is performed again
Diffstat (limited to 'compiler/ccgexprs.nim')
-rw-r--r-- | compiler/ccgexprs.nim | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 426f1b813..6a2ffe752 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1331,8 +1331,14 @@ proc genInOp(p: BProc, e: PNode, d: var TLoc) = var a, b, x, y: TLoc if (e.sons[1].Kind == nkCurly) and fewCmps(e.sons[1]): # a set constructor but not a constant set: - # do not emit the set, but generate a bunch of comparisons - initLocExpr(p, e.sons[2], a) + # do not emit the set, but generate a bunch of comparisons; and if we do + # so, we skip the unnecessary range check: This is a semantical extension + # that code now relies on. :-/ XXX + let ea = if e.sons[2].kind in {nkChckRange, nkChckRange64}: + e.sons[2].sons[0] + else: + e.sons[2] + initLocExpr(p, ea, a) initLoc(b, locExpr, e.typ, OnUnknown) b.r = toRope("(") var length = sonsLen(e.sons[1]) |