JS codegen improvements; barely usable now

This commit is contained in:
Araq
2012-07-02 01:41:16 +02:00
parent fe285b354d
commit f2af2fb478
4 changed files with 71 additions and 25 deletions

23
tests/js/test1.nim Normal file
View File

@@ -0,0 +1,23 @@
discard """
cmd: "nimrod js --hints:on $# $#"
output: "1261129"
"""
# This file tests the ECMAScript generator
import
dom, strutils
var
inputElement = "1123"
proc OnButtonClick(inputElement: string) {.exportc.} =
let v = $inputElement
if v.allCharsInSet(whiteSpace):
echo "only whitespace, hu?"
else:
var x = parseInt(v)
echo x*x
onButtonClick(inputElement)