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

This commit is contained in:
Araq
2011-11-02 00:55:45 +01:00
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)])
of mNew, mNewFinalize: genNew(p, n, r)
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 mLengthStr: unaryExpr(p, n, r, "", "($1.length-1)")
of mLengthSeq, mLengthOpenArray, mLengthArray:

View File

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

View File

@@ -7,7 +7,8 @@
# 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
PSafePoint = ptr TSafePoint

View File

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