summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-08-23 17:11:10 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-08-23 17:51:26 +0200
commit200ccff015e2e085a260e948eed50dfaf4cc6e8c (patch)
tree5f3ffd54b92785eb1cb099a424de4cb7298cf0cd /compiler
parenteb03040d7d810a0d31c5d4ae3835d02631d450fe (diff)
downloadNim-200ccff015e2e085a260e948eed50dfaf4cc6e8c.tar.gz
fixes #4632
Diffstat (limited to 'compiler')
-rw-r--r--compiler/jsgen.nim17
1 files changed, 9 insertions, 8 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim
index a0b54812f..1790daf7a 100644
--- a/compiler/jsgen.nim
+++ b/compiler/jsgen.nim
@@ -1280,14 +1280,15 @@ proc genInfixCall(p: PProc, n: PNode, r: var TCompRes) =
       assert(typ.kind == tyProc)
       genPatternCall(p, n, pat, typ, r)
       return
-  gen(p, n.sons[1], r)
-  if r.typ == etyBaseIndex:
-    if r.address == nil:
-      globalError(n.info, "cannot invoke with infix syntax")
-    r.res = "$1[$2]" % [r.address, r.res]
-    r.address = nil
-    r.typ = etyNone
-  add(r.res, "." | "->")
+  if n.len != 1:
+    gen(p, n.sons[1], r)
+    if r.typ == etyBaseIndex:
+      if r.address == nil:
+        globalError(n.info, "cannot invoke with infix syntax")
+      r.res = "$1[$2]" % [r.address, r.res]
+      r.address = nil
+      r.typ = etyNone
+    add(r.res, "." | "->")
   var op: TCompRes
   if p.target == targetPHP:
     op.kind = resCallee