mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-06 21:17:48 +00:00
Merge branch 'master' of github.com:Araq/Nimrod
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user