summary refs log tree commit diff stats
path: root/compiler/jsgen.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-04-26 12:50:36 +0200
committerAndreas Rumpf <rumpf_a@web.de>2017-04-26 12:50:36 +0200
commit3d34a9f6d34809a481024a687ed5f4d712a9b961 (patch)
treed250fd06e7c8c205f8584cb83e1af05db59aefc7 /compiler/jsgen.nim
parent4cce5883c063ad79564b5e1734f1a62060063ab3 (diff)
downloadNim-3d34a9f6d34809a481024a687ed5f4d712a9b961.tar.gz
js codegen: emit more line information
Diffstat (limited to 'compiler/jsgen.nim')
-rw-r--r--compiler/jsgen.nim26
1 files changed, 14 insertions, 12 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim
index 0016a8492..ad988d1b0 100644
--- a/compiler/jsgen.nim
+++ b/compiler/jsgen.nim
@@ -434,22 +434,23 @@ proc binaryExpr(p: PProc, n: PNode, r: var TCompRes, magic, frmt: string) =
 
 proc unsignedTrimmerJS(size: BiggestInt): Rope =
   case size
-    of 1: rope"& 0xff"
-    of 2: rope"& 0xffff"
-    of 4: rope">>> 0"
-    else: rope""
+  of 1: rope"& 0xff"
+  of 2: rope"& 0xffff"
+  of 4: rope">>> 0"
+  else: rope""
 
 proc unsignedTrimmerPHP(size: BiggestInt): Rope =
   case size
-    of 1: rope"& 0xff"
-    of 2: rope"& 0xffff"
-    of 4: rope"& 0xffffffff"
-    else: rope""
+  of 1: rope"& 0xff"
+  of 2: rope"& 0xffff"
+  of 4: rope"& 0xffffffff"
+  else: rope""
 
 template unsignedTrimmer(size: BiggestInt): Rope =
   size.unsignedTrimmerJS | size.unsignedTrimmerPHP
 
-proc binaryUintExpr(p: PProc, n: PNode, r: var TCompRes, op: string, reassign: bool = false) =
+proc binaryUintExpr(p: PProc, n: PNode, r: var TCompRes, op: string,
+                    reassign = false) =
   var x, y: TCompRes
   gen(p, n.sons[1], x)
   gen(p, n.sons[2], y)
@@ -1633,11 +1634,11 @@ proc genReprAux(p: PProc, n: PNode, r: var TCompRes, magic: string, typ: Rope =
 
   gen(p, n.sons[1], a)
   if magic == "reprAny":
-    # the pointer argument in reprAny is expandend to 
+    # the pointer argument in reprAny is expandend to
     # (pointedto, pointer), so we need to fill it
     if a.address.isNil:
       add(r.res, a.res)
-      add(r.res, ", null") 
+      add(r.res, ", null")
     else:
       add(r.res, "$1, $2" % [a.address, a.res])
   else:
@@ -1670,7 +1671,7 @@ proc genRepr(p: PProc, n: PNode, r: var TCompRes) =
     genReprAux(p, n, r, "reprSet", genTypeInfo(p, t))
   of tyEmpty, tyVoid:
     localError(n.info, "'repr' doesn't support 'void' type")
-  of tyPointer: 
+  of tyPointer:
     genReprAux(p, n, r, "reprPointer")
   of tyOpenArray, tyVarargs:
     genReprAux(p, n, r, "reprJSONStringify")
@@ -2128,6 +2129,7 @@ proc gen(p: PProc, n: PNode, r: var TCompRes) =
     else: r.res = rope(f.toStrMaxPrecision)
     r.kind = resExpr
   of nkCallKinds:
+    if isEmptyType(n.typ): genLineDir(p, n)
     if (n.sons[0].kind == nkSym) and (n.sons[0].sym.magic != mNone):
       genMagic(p, n, r)
     elif n.sons[0].kind == nkSym and sfInfixCall in n.sons[0].sym.flags and