'ord' does not produce a range type anymore
This commit is contained in:
parent
b7bce6f900
commit
762ade1177
4 changed files with 7 additions and 4 deletions
|
|
@ -109,3 +109,4 @@ proc initDefines*() =
|
||||||
defineSymbol("nimGenericInOutFlags")
|
defineSymbol("nimGenericInOutFlags")
|
||||||
when false: defineSymbol("nimHasOpt")
|
when false: defineSymbol("nimHasOpt")
|
||||||
defineSymbol("nimNoArrayToCstringConversion")
|
defineSymbol("nimNoArrayToCstringConversion")
|
||||||
|
defineSymbol("nimNewRoof")
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,9 @@ proc semTypeTraits(c: PContext, n: PNode): PNode =
|
||||||
proc semOrd(c: PContext, n: PNode): PNode =
|
proc semOrd(c: PContext, n: PNode): PNode =
|
||||||
result = n
|
result = n
|
||||||
let parType = n.sons[1].typ
|
let parType = n.sons[1].typ
|
||||||
if isOrdinalType(parType) or parType.kind == tySet:
|
if isOrdinalType(parType):
|
||||||
|
discard
|
||||||
|
elif parType.kind == tySet:
|
||||||
result.typ = makeRangeType(c, firstOrd(parType), lastOrd(parType), n.info)
|
result.typ = makeRangeType(c, firstOrd(parType), lastOrd(parType), n.info)
|
||||||
else:
|
else:
|
||||||
localError(n.info, errOrdinalTypeExpected)
|
localError(n.info, errOrdinalTypeExpected)
|
||||||
|
|
|
||||||
|
|
@ -1225,7 +1225,7 @@ when not defined(JS):
|
||||||
result.minute = t.minute
|
result.minute = t.minute
|
||||||
result.hour = t.hour
|
result.hour = t.hour
|
||||||
result.monthday = t.monthday
|
result.monthday = t.monthday
|
||||||
result.month = ord(t.month)
|
result.month = cint(t.month)
|
||||||
result.year = cint(t.year - 1900)
|
result.year = cint(t.year - 1900)
|
||||||
result.weekday = weekDays[t.weekday]
|
result.weekday = weekDays[t.weekday]
|
||||||
result.yearday = t.yearday
|
result.yearday = t.yearday
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ proc write(f: File, r: float32) =
|
||||||
proc write(f: File, r: BiggestFloat) =
|
proc write(f: File, r: BiggestFloat) =
|
||||||
if c_fprintf(f, "%g", r) < 0: checkErr(f)
|
if c_fprintf(f, "%g", r) < 0: checkErr(f)
|
||||||
|
|
||||||
proc write(f: File, c: char) = discard c_putc(ord(c), f)
|
proc write(f: File, c: char) = discard c_putc(cint(c), f)
|
||||||
proc write(f: File, a: varargs[string, `$`]) =
|
proc write(f: File, a: varargs[string, `$`]) =
|
||||||
for x in items(a): write(f, x)
|
for x in items(a): write(f, x)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue