summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-12-19 12:53:51 +0100
committerAraq <rumpf_a@web.de>2014-12-19 12:53:51 +0100
commit18cbd516007aac73cf6a3384b09b2b020a86cba6 (patch)
treec275d073378b4c5637a20aea2f4c80169cc2c9b6 /compiler
parentbce10ac1d3cb94d8ebb4482057752ee938a56c18 (diff)
downloadNim-18cbd516007aac73cf6a3384b09b2b020a86cba6.tar.gz
fixes #1187
Diffstat (limited to 'compiler')
-rw-r--r--compiler/renderer.nim4
-rw-r--r--compiler/semtypes.nim10
-rw-r--r--compiler/semtypinst.nim5
3 files changed, 10 insertions, 9 deletions
diff --git a/compiler/renderer.nim b/compiler/renderer.nim
index 3f7b0e657..f25f3e7ee 100644
--- a/compiler/renderer.nim
+++ b/compiler/renderer.nim
@@ -947,10 +947,10 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
   of nkConstDef, nkIdentDefs:
     gcomma(g, n, 0, -3)
     var L = sonsLen(n)
-    if n.sons[L - 2].kind != nkEmpty: 
+    if L >= 2 and n.sons[L - 2].kind != nkEmpty: 
       putWithSpace(g, tkColon, ":")
       gsub(g, n.sons[L - 2])
-    if n.sons[L - 1].kind != nkEmpty: 
+    if L >= 1 and n.sons[L - 1].kind != nkEmpty: 
       put(g, tkSpaces, Space)
       putWithSpace(g, tkEquals, "=")
       gsub(g, n.sons[L - 1], c)
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index e33df75ff..4305a48e1 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -386,13 +386,13 @@ proc semIdentVis(c: PContext, kind: TSymKind, n: PNode,
   else:
     result = newSymG(kind, n, c)
   
-proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode, 
-                        allowed: TSymFlags): PSym = 
-  if n.kind == nkPragmaExpr: 
+proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode,
+                        allowed: TSymFlags): PSym =
+  if n.kind == nkPragmaExpr:
     checkSonsLen(n, 2)
     result = semIdentVis(c, kind, n.sons[0], allowed)
     case kind
-    of skType: 
+    of skType:
       # process pragmas later, because result.typ has not been set yet
       discard
     of skField: pragma(c, result, n.sons[1], fieldPragmas)
@@ -403,7 +403,7 @@ proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode,
   else:
     result = semIdentVis(c, kind, n, allowed)
   if gCmd == cmdPretty: styleCheckDef(n.info, result)
-  
+
 proc checkForOverlap(c: PContext, t: PNode, currentEx, branchIndex: int) =
   let ex = t[branchIndex][currentEx].skipConv
   for i in countup(1, branchIndex):
diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim
index c53464f80..e069064c2 100644
--- a/compiler/semtypinst.nim
+++ b/compiler/semtypinst.nim
@@ -292,7 +292,8 @@ proc handleGenericInvokation(cl: var TReplTypeVars, t: PType): PType =
   var newbody = replaceTypeVarsT(cl, lastSon(body))
   newbody.flags = newbody.flags + (t.flags + body.flags - tfInstClearedFlags)
   result.flags = result.flags + newbody.flags - tfInstClearedFlags
-  newbody.callConv = body.callConv
+  # This is actually wrong: tgeneric_closure fails with this line:
+  #newbody.callConv = body.callConv
   # This type may be a generic alias and we want to resolve it here.
   # One step is enough, because the recursive nature of
   # handleGenericInvokation will handle the alias-to-alias-to-alias case
@@ -307,7 +308,7 @@ proc handleGenericInvokation(cl: var TReplTypeVars, t: PType): PType =
 
 proc eraseVoidParams*(t: PType) =
   # transform '(): void' into '()' because old parts of the compiler really
-  # doesn't deal with '(): void':
+  # don't deal with '(): void':
   if t.sons[0] != nil and t.sons[0].kind == tyEmpty:
     t.sons[0] = nil