summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
authordom96 <dominikpicheta@googlemail.com>2011-09-23 21:43:24 +0100
committerdom96 <dominikpicheta@googlemail.com>2011-09-23 21:43:24 +0100
commit6deda5a973312e86fe58e319e97afd93bc07c82d (patch)
tree0769b2871024febab389c8bc72d01cd770b52cfb /lib/system
parent2359b8b1073cfd027ac14a147aba06cc18d61010 (diff)
downloadNim-6deda5a973312e86fe58e319e97afd93bc07c82d.tar.gz
Fixed string concatenation and other bugs in the JS backend. Fixed a small bug in the IRC module.
Diffstat (limited to 'lib/system')
-rwxr-xr-xlib/system/ecmasys.nim2
-rw-r--r--lib/system/reprjs.nim23
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/system/ecmasys.nim b/lib/system/ecmasys.nim
index ece33d9dc..5dc01f46e 100755
--- a/lib/system/ecmasys.nim
+++ b/lib/system/ecmasys.nim
@@ -228,7 +228,7 @@ proc cmp(x, y: string): int = return cmpStrings(x, y)
 
 proc eqStrings(a, b: string): bool {.noStackFrame, compilerProc.} =
   asm """
-    if (`a == `b`) return true;
+    if (`a` == `b`) return true;
     if ((!`a`) || (!`b`)) return false;
     var alen = `a`.length;
     if (alen != `b`.length) return false;
diff --git a/lib/system/reprjs.nim b/lib/system/reprjs.nim
new file mode 100644
index 000000000..b6b6ffe9c
--- /dev/null
+++ b/lib/system/reprjs.nim
@@ -0,0 +1,23 @@
+#
+#
+#            Nimrod's Runtime Library
+#        (c) Copyright 2011 Andreas Rumpf
+#
+#    See the file "copying.txt", included in this
+#    distribution, for details about the copyright.
+#
+
+proc reprInt(x: int64): string {.compilerproc.} = return $x
+
+proc reprEnum(e: int, typ: PNimType): string {.compilerRtl.} =
+  if ntfEnumHole notin typ.flags:
+    if e <% typ.node.len:
+      return $typ.node.sons[e].name
+  else:
+    # ugh we need a slow linear search:
+    var n = typ.node
+    var s = n.sons
+    for i in 0 .. n.len-1:
+      if s[i].offset == e: return $s[i].name
+  result = $e & " (invalid data!)"
+