json code generation works again
This commit is contained in:
parent
5131b3cea4
commit
cb21fd4f8f
6 changed files with 17 additions and 14 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ type
|
|||
|
||||
TFileModuleMap = seq[TFileModuleRec]
|
||||
|
||||
var compMods: TFileModuleMap = @ []
|
||||
var compMods: TFileModuleMap = @[]
|
||||
|
||||
proc registerModule(filename: string, module: PSym) =
|
||||
# all compiled modules
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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!"
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue