diff options
-rwxr-xr-x | compiler/ecmasgen.nim | 6 | ||||
-rwxr-xr-x | compiler/main.nim | 2 | ||||
-rwxr-xr-x | lib/system.nim | 9 | ||||
-rwxr-xr-x | lib/system/ecmasys.nim | 2 | ||||
-rwxr-xr-x | tests/ecmas.nim | 11 | ||||
-rwxr-xr-x | tests/tester.nim | 1 |
6 files changed, 17 insertions, 14 deletions
diff --git a/compiler/ecmasgen.nim b/compiler/ecmasgen.nim index 8fc525a28..66f315dc3 100755 --- a/compiler/ecmasgen.nim +++ b/compiler/ecmasgen.nim @@ -940,8 +940,8 @@ proc createVar(p: var TProc, typ: PType, indirect: bool): PRope = result = putToSeq("0", indirect) of tyFloat..tyFloat128: result = putToSeq("0.0", indirect) - of tyRange: - result = createVar(p, typ.sons[0], indirect) + of tyRange, tyGenericInst: + result = createVar(p, lastSon(typ), indirect) of tySet: result = toRope("{}") of tyBool: @@ -979,7 +979,7 @@ proc createVar(p: var TProc, typ: PType, indirect: bool): PRope = of tyVar, tyPtr, tyRef: if mapType(t) == etyBaseIndex: result = putToSeq("[null, 0]", indirect) else: result = putToSeq("null", indirect) - of tySequence, tyString, tyCString, tyPointer: + of tySequence, tyString, tyCString, tyPointer, tyProc: result = putToSeq("null", indirect) else: internalError("createVar: " & $t.kind) diff --git a/compiler/main.nim b/compiler/main.nim index b7670f5aa..d08e94397 100755 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -34,7 +34,7 @@ type TFileModuleMap = seq[TFileModuleRec] -var compMods: TFileModuleMap = @ [] +var compMods: TFileModuleMap = @[] proc registerModule(filename: string, module: PSym) = # all compiled modules diff --git a/lib/system.nim b/lib/system.nim index 33e350d7e..b32f17d6a 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -1470,10 +1470,6 @@ type filename: CString len: int # length of slots (when not debugging always zero) -when defined(ecmaScript): - var - framePtr {.compilerproc.}: PFrame - when not defined(ECMAScript): {.push stack_trace:off} proc add*(x: var string, y: cstring) = @@ -1877,6 +1873,11 @@ elif defined(ecmaScript) or defined(NimrodVM): proc alloc0(size: int): pointer = nil proc realloc(p: Pointer, newsize: int): pointer = nil + proc allocShared(size: int): pointer = nil + proc allocShared0(size: int): pointer = nil + proc deallocShared(p: pointer) = nil + proc reallocShared(p: pointer, newsize: int): pointer = nil + when defined(ecmaScript): include "system/ecmasys" elif defined(NimrodVM): diff --git a/lib/system/ecmasys.nim b/lib/system/ecmasys.nim index 7f91feb6b..b68592989 100755 --- a/lib/system/ecmasys.nim +++ b/lib/system/ecmasys.nim @@ -1,7 +1,7 @@ # # # Nimrod's Runtime Library -# (c) Copyright 2010 Andreas Rumpf +# (c) Copyright 2011 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. diff --git a/tests/ecmas.nim b/tests/ecmas.nim index c25d063c1..e2c7a2107 100755 --- a/tests/ecmas.nim +++ b/tests/ecmas.nim @@ -1,3 +1,7 @@ +discard """ + cmd: "nimrod js --hints:on $# $#" +""" + # This file tests the ECMAScript generator import @@ -9,11 +13,8 @@ var inputElement {.importc: "document.form1.input1", nodecl.}: ref TElement proc OnButtonClick() {.exportc.} = - #var x = parseInt($inputElement.value) - #echo($(x * x)) - var input = $inputElement.value - echo "Test" - echo "Hi, ", input + var x = parseInt($inputElement.value) + echo x*x proc OnLoad() {.exportc.} = echo "Welcome! Please take your time to fill in this formular!" diff --git a/tests/tester.nim b/tests/tester.nim index a3c7b6a63..df01c8de3 100755 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -301,6 +301,7 @@ proc main(action: string) = of "compile": var compileRes = initResults() compile(compileRes, "tests/accept/compile/t*.nim", options) + compile(compileRes, "tests/ecmas.nim", options) writeResults(compileJson, compileRes) of "examples": var compileRes = readResults(compileJson) |