diff options
author | Araq <rumpf_a@web.de> | 2014-04-21 01:34:54 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-04-21 01:34:54 +0200 |
commit | 042ffed6c4564625021bdb1d15ac1a0e8f5b5852 (patch) | |
tree | c1102e4e3b2642dcafb0caef06d00b5a85baa64a /compiler | |
parent | 2c972427399da894f91d0a4bd067b63866bb20ea (diff) | |
download | Nim-042ffed6c4564625021bdb1d15ac1a0e8f5b5852.tar.gz |
some progress for #1082
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semtypes.nim | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 384bdc8a3..6289ecc85 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -194,10 +194,15 @@ proc semRange(c: PContext, n: PNode, prev: PType): PType = if isRange(n[1]): result = semRangeAux(c, n[1], prev) let n = result.n - if n.sons[0].kind in {nkCharLit..nkUInt64Lit}: - if n.sons[0].intVal > 0 or n.sons[1].intVal < 0: - incl(result.flags, tfNeedsInit) - elif n.sons[0].floatVal > 0.0 or n.sons[1].floatVal < 0.0: + if n.sons[0].kind in {nkCharLit..nkUInt64Lit} and n.sons[0].intVal > 0: + incl(result.flags, tfNeedsInit) + elif n.sons[1].kind in {nkCharLit..nkUInt64Lit} and n.sons[1].intVal < 0: + incl(result.flags, tfNeedsInit) + elif n.sons[0].kind in {nkFloatLit..nkFloat64Lit} and + n.sons[0].floatVal > 0.0: + incl(result.flags, tfNeedsInit) + elif n.sons[1].kind in {nkFloatLit..nkFloat64Lit} and + n.sons[1].floatVal < 0.0: incl(result.flags, tfNeedsInit) else: localError(n.sons[0].info, errRangeExpected) |