Merge branch 'master' of github.com:Araq/Nimrod

This commit is contained in:
Araq 2011-11-02 00:55:45 +01:00
commit 95df3ee1ce
4 changed files with 14 additions and 13 deletions

View file

@ -1141,7 +1141,7 @@ proc genMagic(p: var TProc, n: PNode, r: var TCompRes) =
[filen, line, mergeExpr(a)]) [filen, line, mergeExpr(a)])
of mNew, mNewFinalize: genNew(p, n, r) of mNew, mNewFinalize: genNew(p, n, r)
of mSizeOf: r.res = toRope(getSize(n.sons[1].typ)) of mSizeOf: r.res = toRope(getSize(n.sons[1].typ))
of mChr: gen(p, n.sons[1], r) # nothing to do of mChr, mArrToSeq: gen(p, n.sons[1], r) # nothing to do
of mOrd: genOrd(p, n, r) of mOrd: genOrd(p, n, r)
of mLengthStr: unaryExpr(p, n, r, "", "($1.length-1)") of mLengthStr: unaryExpr(p, n, r, "", "($1.length-1)")
of mLengthSeq, mLengthOpenArray, mLengthArray: of mLengthSeq, mLengthOpenArray, mLengthArray:

View file

@ -190,7 +190,7 @@ when not defined(ECMAScript):
else: else:
proc mathrandom(): float {.importc: "Math.random", nodecl.} proc mathrandom(): float {.importc: "Math.random", nodecl.}
proc floor*(x: float): float {.importc: "Math.floor", nodecl.} proc floor*(x: float): float {.importc: "Math.floor", nodecl.}
proc random*(max: int): int = return floor(mathrandom() * max) proc random*(max: int): int = return int(floor(mathrandom() * float(max)))
proc randomize*() = nil proc randomize*() = nil
proc sqrt*(x: float): float {.importc: "Math.sqrt", nodecl.} proc sqrt*(x: float): float {.importc: "Math.sqrt", nodecl.}
@ -204,7 +204,7 @@ else:
proc frexp*(x: float, exponent: var int): float = proc frexp*(x: float, exponent: var int): float =
if x == 0.0: if x == 0.0:
exponent = 0.0 exponent = 0
result = 0.0 result = 0.0
elif x < 0.0: elif x < 0.0:
result = -frexp(-x, exponent) result = -frexp(-x, exponent)

View file

@ -7,7 +7,8 @@
# distribution, for details about the copyright. # distribution, for details about the copyright.
# #
proc alert(s: cstring) {.importc, nodecl.} proc alert*(s: cstring) {.importc, nodecl.}
proc log*(s: cstring) {.importc: "console.log", nodecl.}
type type
PSafePoint = ptr TSafePoint PSafePoint = ptr TSafePoint

View file

@ -288,25 +288,25 @@ proc runRodFiles(r: var TResults, options: string) =
delNimCache() delNimCache()
# test basic recompilation scheme: # test basic recompilation scheme:
test "hallo" test "hallo.nim"
test "hallo" test "hallo.nim"
# test incremental type information: # test incremental type information:
test "hallo2" test "hallo2.nim"
delNimCache() delNimCache()
# test type converters: # test type converters:
test "aconv" test "aconv.nim"
test "bconv" test "bconv.nim"
delNimCache() delNimCache()
# test G, A, B example from the documentation; test init sections: # test G, A, B example from the documentation; test init sections:
test "deada" test "deada.nim"
test "deada2" test "deada2.nim"
delNimCache() delNimCache()
# test method generation: # test method generation:
test "bmethods" test "bmethods.nim"
test "bmethods2" test "bmethods2.nim"
delNimCache() delNimCache()