summary refs log tree commit diff stats
path: root/rod
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-laptop>2010-03-14 01:25:25 +0100
committerAndreas Rumpf <andreas@andreas-laptop>2010-03-14 01:25:25 +0100
commit7bf98411b6d4dfd203371b5d2ec0a5ef3a2305df (patch)
tree23f76f650800ca9508e17869cc83fc8061d1f310 /rod
parent3dafd6856bfd644e9cf518b36e5bfedc3220a702 (diff)
downloadNim-7bf98411b6d4dfd203371b5d2ec0a5ef3a2305df.tar.gz
version 0.8.8
Diffstat (limited to 'rod')
-rwxr-xr-xrod/ccgexprs.nim9
-rwxr-xr-xrod/evals.nim52
-rwxr-xr-xrod/extccomp.nim6
-rwxr-xr-xrod/msgs.nim4
-rwxr-xr-xrod/nimrod.ini23
-rwxr-xr-xrod/nimrod.nim2
-rwxr-xr-xrod/nversion.nim2
-rwxr-xr-xrod/passes.nim60
-rwxr-xr-xrod/semexprs.nim9
-rwxr-xr-xrod/sigmatch.nim45
-rwxr-xr-xrod/syntaxes.nim6
11 files changed, 105 insertions, 113 deletions
diff --git a/rod/ccgexprs.nim b/rod/ccgexprs.nim
index ecff707ae..6eae842f2 100755
--- a/rod/ccgexprs.nim
+++ b/rod/ccgexprs.nim
@@ -1093,15 +1093,16 @@ proc genRepr(p: BProc, e: PNode, d: var TLoc) =
                 ropef("reprSet($1, $2)", [rdLoc(a), genTypeInfo(p.module, t)]))
   of tyOpenArray: 
     useMagic(p.module, "reprOpenArray")
+    var b: TLoc
     case a.t.kind
-    of tyOpenArray: putIntoDest(p, d, e.typ, ropef("$1, $1Len0", [rdLoc(a)]))
+    of tyOpenArray: putIntoDest(p, b, e.typ, rdLoc(a))
     of tyString, tySequence: 
-      putIntoDest(p, d, e.typ, ropef("$1->data, $1->Sup.len", [rdLoc(a)]))
+      putIntoDest(p, b, e.typ, ropef("$1->data, $1->Sup.len", [rdLoc(a)]))
     of tyArray, tyArrayConstr: 
-      putIntoDest(p, d, e.typ, 
+      putIntoDest(p, b, e.typ, 
                   ropef("$1, $2", [rdLoc(a), toRope(lengthOrd(a.t))]))
     else: InternalError(e.sons[0].info, "genRepr()")
-    putIntoDest(p, d, e.typ, ropef("reprOpenArray($1, $2)", [rdLoc(d), 
+    putIntoDest(p, d, e.typ, ropef("reprOpenArray($1, $2)", [rdLoc(b), 
         genTypeInfo(p.module, elemType(t))]))
   of tyCString, tyArray, tyArrayConstr, tyRef, tyPtr, tyPointer, tyNil, 
      tySequence: 
diff --git a/rod/evals.nim b/rod/evals.nim
index b3fa08a0b..79428e60f 100755
--- a/rod/evals.nim
+++ b/rod/evals.nim
@@ -259,6 +259,10 @@ proc evalCall(c: PEvalContext, n: PNode): PNode =
   if n.typ != nil: result = d.params[0]
   popStackFrame(c)
 
+proc aliasNeeded(n: PNode, flags: TEvalFlags): bool = 
+  result = efLValue in flags or n.typ == nil or 
+    n.typ.kind in {tyExpr, tyStmt, tyTypeDesc}
+
 proc evalVariable(c: PStackFrame, sym: PSym, flags: TEvalFlags): PNode = 
   # We need to return a node to the actual value,
   # which can be modified.
@@ -269,7 +273,7 @@ proc evalVariable(c: PStackFrame, sym: PSym, flags: TEvalFlags): PNode =
       if result == nil: result = emptyNode
       return
     result = IdNodeTableGet(x.mapping, sym)
-    if efLValue notin flags: result = copyTree(result)
+    if not aliasNeeded(result, flags): result = copyTree(result)
     if result != nil: return 
     x = x.next
   result = emptyNode
@@ -286,7 +290,7 @@ proc evalArrayAccess(c: PEvalContext, n: PNode, flags: TEvalFlags): PNode =
   of nkBracket, nkPar, nkMetaNode: 
     if (idx >= 0) and (idx < sonsLen(x)): result = x.sons[int(idx)]
     else: stackTrace(c, n, errIndexOutOfBounds)
-    if efLValue notin flags: result = copyTree(result)
+    if not aliasNeeded(result, flags): result = copyTree(result)
   of nkStrLit..nkTripleStrLit: 
     if efLValue in flags: 
       InternalError(n.info, "cannot evaluate write access to char")
@@ -313,7 +317,7 @@ proc evalFieldAccess(c: PEvalContext, n: PNode, flags: TEvalFlags): PNode =
       InternalError(n.info, "evalFieldAccess")
     if x.sons[i].sons[0].sym.name.id == field.id: 
       result = x.sons[i].sons[1]
-      if efLValue in flags: result = copyTree(result)
+      if not aliasNeeded(result, flags): result = copyTree(result)
       return
   stackTrace(c, n, errFieldXNotFound, field.name.s)
   result = emptyNode
@@ -705,7 +709,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
   of mAppendStrStr: result = evalAppendStrStr(c, n)
   of mAppendSeqElem: result = evalAppendSeqElem(c, n)
   of mNLen: 
-    result = evalAux(c, n.sons[1], {})
+    result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
     result = newNodeIT(nkIntLit, n.info, n.typ)
@@ -714,10 +718,10 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
       nil
     else: result.intVal = sonsLen(a)
   of mNChild: 
-    result = evalAux(c, n.sons[1], {})
+    result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if isSpecial(result): return 
     var k = getOrdValue(result)
     if not (a.kind in {nkEmpty..nkNilLit}) and (k >= 0) and (k < sonsLen(a)): 
@@ -730,10 +734,10 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if isSpecial(result): return 
     var b = result
-    result = evalAux(c, n.sons[3], {})
+    result = evalAux(c, n.sons[3], {efLValue})
     if isSpecial(result): return 
     var k = getOrdValue(b)
     if (k >= 0) and (k < sonsLen(a)) and not (a.kind in {nkEmpty..nkNilLit}): 
@@ -746,7 +750,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if isSpecial(result): return 
     addSon(a, result)
     result = emptyNode
@@ -754,7 +758,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if isSpecial(result): return 
     for i in countup(0, sonsLen(result) - 1): addSon(a, result.sons[i])
     result = emptyNode
@@ -762,10 +766,10 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if isSpecial(result): return 
     var b = result
-    result = evalAux(c, n.sons[3], {})
+    result = evalAux(c, n.sons[3], {efLValue})
     if isSpecial(result): return 
     for i in countup(0, int(getOrdValue(result)) - 1): 
       delSon(a, int(getOrdValue(b)))
@@ -793,7 +797,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     of nkFloatLit..nkFloat64Lit: result.floatVal = a.floatVal
     else: InternalError(n.info, "no float value")
   of mNSymbol: 
-    result = evalAux(c, n.sons[1], {})
+    result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     if result.kind != nkSym: InternalError(n.info, "no symbol")
   of mNIdent: 
@@ -829,7 +833,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if isSpecial(result): return 
     a.sym = result.sym        # XXX: exception handling?
     result = emptyNode
@@ -837,7 +841,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if isSpecial(result): return 
     a.ident = result.ident    # XXX: exception handling?
     result = emptyNode
@@ -845,7 +849,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if isSpecial(result): return 
     a.typ = result.typ        # XXX: exception handling?
     result = emptyNode
@@ -861,7 +865,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     result = evalAux(c, n.sons[1], {})
     if isSpecial(result): return 
     var k = getOrdValue(result)
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if result.kind == nkExceptBranch: return 
     var a = result
     if (k < 0) or (k > ord(high(TNodeKind))): 
@@ -869,11 +873,11 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     result = newNodeI(TNodeKind(int(k)), 
       if a.kind == nkNilLit: n.info else: a.info)
   of mNCopyNimNode: 
-    result = evalAux(c, n.sons[1], {})
+    result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     result = copyNode(result)
   of mNCopyNimTree: 
-    result = evalAux(c, n.sons[1], {})
+    result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     result = copyTree(result)
   of mStrToIdent: 
@@ -902,10 +906,10 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode =
     if (a.kind == nkIdent) and (b.kind == nkIdent): 
       if a.ident.id == b.ident.id: result.intVal = 1
   of mEqNimrodNode: 
-    result = evalAux(c, n.sons[1], {})
+    result = evalAux(c, n.sons[1], {efLValue})
     if isSpecial(result): return 
     var a = result
-    result = evalAux(c, n.sons[2], {})
+    result = evalAux(c, n.sons[2], {efLValue})
     if isSpecial(result): return 
     var b = result
     result = newNodeIT(nkIntLit, n.info, n.typ)
@@ -966,16 +970,18 @@ proc evalAux(c: PEvalContext, n: PNode, flags: TEvalFlags): PNode =
   of nkCall, nkHiddenCallConv, nkMacroStmt, nkCommand, nkCallStrLit: 
     result = evalMagicOrCall(c, n)
   of nkCurly, nkBracket, nkRange: 
+    # flags need to be passed here for mNAddMultiple :-(
+    # XXX this is not correct in every case!
     var a = copyNode(n)
     for i in countup(0, sonsLen(n) - 1): 
-      result = evalAux(c, n.sons[i], {})
+      result = evalAux(c, n.sons[i], flags)
       if isSpecial(result): return 
       addSon(a, result)
     result = a
   of nkPar: 
     var a = copyTree(n)
     for i in countup(0, sonsLen(n) - 1): 
-      result = evalAux(c, n.sons[i].sons[1], {})
+      result = evalAux(c, n.sons[i].sons[1], flags)
       if isSpecial(result): return 
       a.sons[i].sons[1] = result
     result = a
diff --git a/rod/extccomp.nim b/rod/extccomp.nim
index 990466e1b..563434e0f 100755
--- a/rod/extccomp.nim
+++ b/rod/extccomp.nim
@@ -283,7 +283,7 @@ proc NameToCC(name: string): TSystemCC =
   result = ccNone
 
 proc addOpt(dest: var string, src: string) = 
-  if (len(dest) == 0) or (dest[len(dest) - 1 + 0] != ' '): add(dest, " ")
+  if len(dest) == 0 or dest[len(dest) - 1 + 0] != ' ': add(dest, " ")
   add(dest, src)
 
 proc addCompileOption(option: string) = 
@@ -308,7 +308,7 @@ proc addFileToLink(filename: string) =
   
 proc execExternalProgram(cmd: string) = 
   if (optListCmd in gGlobalOptions) or (gVerbosity > 0): MessageOut(cmd)
-  if execCmd(cmd) != 0: rawMessage(errExecutionOfProgramFailed)
+  if execCmd(cmd) != 0: rawMessage(errExecutionOfProgramFailed, "")
   
 proc generateScript(projectFile: string, script: PRope) = 
   var (dir, name, ext) = splitFile(projectFile)
@@ -425,7 +425,7 @@ proc CallCCompiler(projectfile: string) =
     else: 
       res = execProcesses(cmds, {poUseShell, poParentStreams}, 
                           gNumberOfProcessors)
-    if res != 0: rawMessage(errExecutionOfProgramFailed)
+    if res != 0: rawMessage(errExecutionOfProgramFailed, [])
   if not (optNoLinking in gGlobalOptions): 
     # call the linker:
     var linkerExe = getConfigVar(cc[c].name & ".linkerexe")
diff --git a/rod/msgs.nim b/rod/msgs.nim
index ca3a5c1e5..01852e0ba 100755
--- a/rod/msgs.nim
+++ b/rod/msgs.nim
@@ -323,7 +323,7 @@ const # this format is understood by many text editors: it is the same that
   RawHintFormat* = "Hint: $1"
 
 proc MessageOut*(s: string)
-proc rawMessage*(msg: TMsgKind, arg: string = "")
+proc rawMessage*(msg: TMsgKind, arg: string)
 proc rawMessage*(msg: TMsgKind, args: openarray[string])
 proc liMessage*(info: TLineInfo, msg: TMsgKind, arg: string = "")
 proc InternalError*(info: TLineInfo, errMsg: string)
@@ -475,7 +475,7 @@ proc rawMessage(msg: TMsgKind, args: openarray[string]) =
   MessageOut(`%`(frmt, `%`(msgKindToString(msg), args)))
   handleError(msg)
 
-proc rawMessage(msg: TMsgKind, arg: string = "") = 
+proc rawMessage(msg: TMsgKind, arg: string) = 
   rawMessage(msg, [arg])
 
 proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string = "") = 
diff --git a/rod/nimrod.ini b/rod/nimrod.ini
index 7c0e8c565..1574721f1 100755
--- a/rod/nimrod.ini
+++ b/rod/nimrod.ini
@@ -72,13 +72,18 @@ Files: "lib/wrappers/x11/*.nim"
 Files: "lib/wrappers/zip/*.nim"
 Files: "lib/wrappers/zip/libzip_all.c"
 
-Files: "lib/newwrap/*.nim"
-
-Files: "lib/newwrap/cairo/*.nim"
-Files: "lib/newwrap/gtk/*.nim"
-Files: "lib/newwrap/lua/*.nim"
-Files: "lib/newwrap/sdl/*.nim"
-Files: "lib/newwrap/x11/*.nim"
+Files: "lib/oldwrappers/*.nim"
+
+Files: "lib/oldwrappers/cairo/*.nim"
+Files: "lib/oldwrappers/gtk/*.nim"
+Files: "lib/oldwrappers/lua/*.nim"
+Files: "lib/oldwrappers/opengl/*.nim"
+Files: "lib/oldwrappers/pcre/*.nim"
+Files: "lib/oldwrappers/pcre/pcre_all.c"
+Files: "lib/oldwrappers/sdl/*.nim"
+Files: "lib/oldwrappers/x11/*.nim"
+Files: "lib/oldwrappers/zip/*.nim"
+Files: "lib/oldwrappers/zip/libzip_all.c"
 
 Files: "lib/windows/*.nim"
 Files: "lib/posix/*.nim"
@@ -90,7 +95,9 @@ Files: "tests/*.html"
 Files: "tests/*.txt"
 Files: "tests/*.cfg"
 Files: "tests/*.tmpl"
-Files: "tests/gtk/*.nim"
+Files: "tests/accept/run/*.nim"
+Files: "tests/accept/compile/*.nim"
+Files: "tests/reject/*.nim"
 
 Files: "examples/*.nim"
 Files: "examples/*.html"
diff --git a/rod/nimrod.nim b/rod/nimrod.nim
index 8f83aa5cd..a6f3365c2 100755
--- a/rod/nimrod.nim
+++ b/rod/nimrod.nim
@@ -42,7 +42,7 @@ proc ProcessCmdLine(pass: TCmdLinePass, command, filename: var string) =
   if pass == passCmd2: 
     arguments = cmdLineRest(p)
     if not (optRun in gGlobalOptions) and (arguments != ""): 
-      rawMessage(errArgsNeedRunOption)
+      rawMessage(errArgsNeedRunOption, [])
   
 proc HandleCmdLine() = 
   var start = getTime()
diff --git a/rod/nversion.nim b/rod/nversion.nim
index 2aa7babf7..8d7c5b263 100755
--- a/rod/nversion.nim
+++ b/rod/nversion.nim
@@ -15,6 +15,6 @@ const
   defaultAsmMarkerSymbol* = '!'
   VersionMajor* = 0
   VersionMinor* = 8
-  VersionPatch* = 7
+  VersionPatch* = 8
   VersionAsString* = $VersionMajor & "." & $VersionMinor & "." & $VersionPatch
 
diff --git a/rod/passes.nim b/rod/passes.nim
index 7ae642ed4..e35f4d045 100755
--- a/rod/passes.nim
+++ b/rod/passes.nim
@@ -1,7 +1,7 @@
 #
 #
 #           The Nimrod Compiler
-#        (c) Copyright 2009 Andreas Rumpf
+#        (c) Copyright 2010 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
@@ -18,36 +18,16 @@ import
 type 
   TPassContext* = object of TObject # the pass's context
   PPassContext* = ref TPassContext
-  TPass* = tuple[open: proc (module: PSym, filename: string): PPassContext, 
-      openCached: proc (module: PSym, filename: string, rd: PRodReader): PPassContext, 
-                 close: proc (p: PPassContext, n: PNode): PNode, 
-                 process: proc (p: PPassContext, topLevelStmt: PNode): PNode] # a 
-                                                                              # pass is a 
-                                                                              # tuple of 
-                                                                              # procedure 
-                                                                              # vars
-                                                                              # 
-                                                                              # ``TPass.close`` 
-                                                                              # may 
-                                                                              # produce 
-                                                                              # additional 
-                                                                              # nodes. 
-                                                                              # These 
-                                                                              # are 
-                                                                              # passed to 
-                                                                              # the 
-                                                                              # other
-                                                                              # 
-                                                                              # close 
-                                                                              # procedures. 
-                                                                              # This 
-                                                                              # mechanism is 
-                                                                              # needed 
-                                                                              # for 
-                                                                              # the 
-                                                                              # instantiation of
-                                                                              # 
-                                                                              # generics.
+  TPass* = tuple[
+    open: proc (module: PSym, filename: string): PPassContext, 
+    openCached: proc (module: PSym, filename: string,
+                     rd: PRodReader): PPassContext, 
+    close: proc (p: PPassContext, n: PNode): PNode, 
+    process: proc (p: PPassContext, topLevelStmt: PNode): PNode] 
+    
+# a  pass is a tuple of procedure vars ``TPass.close`` may produce additional 
+# nodes. These are passed to the other close procedures. 
+# This mechanism is needed for the instantiation of generics.
 
 proc registerPass*(p: TPass)
 proc initPass*(p: var TPass)
@@ -62,7 +42,8 @@ proc astNeeded*(s: PSym): bool
   # needs to be stored. The passes manager frees s.sons[codePos] when
   # appropriate to free the procedure body's memory. This is important
   # to keep memory usage down.
-  # the semantic checker needs these:
+
+# the semantic checker needs these:
 var 
   gImportModule*: proc (filename: string): PSym
   gIncludeFile*: proc (filename: string): PNode
@@ -105,29 +86,25 @@ proc openPassesCached(a: var TPassContextArray, module: PSym, filename: string,
       a[i] = nil
   
 proc closePasses(a: var TPassContextArray) = 
-  var m: PNode
-  m = nil
+  var m: PNode = nil
   for i in countup(0, gPassesLen - 1): 
     if not isNil(gPasses[i].close): m = gPasses[i].close(a[i], m)
     a[i] = nil                # free the memory here
   
 proc processTopLevelStmt(n: PNode, a: var TPassContextArray) = 
-  var m: PNode
   # this implements the code transformation pipeline
-  m = n
+  var m = n
   for i in countup(0, gPassesLen - 1): 
     if not isNil(gPasses[i].process): m = gPasses[i].process(a[i], m)
   
 proc processTopLevelStmtCached(n: PNode, a: var TPassContextArray) = 
-  var m: PNode
   # this implements the code transformation pipeline
-  m = n
+  var m = n
   for i in countup(0, gPassesLen - 1): 
     if not isNil(gPasses[i].openCached): m = gPasses[i].process(a[i], m)
   
 proc closePassesCached(a: var TPassContextArray) = 
-  var m: PNode
-  m = nil
+  var m: PNode = nil
   for i in countup(0, gPassesLen - 1): 
     if not isNil(gPasses[i].openCached) and not isNil(gPasses[i].close): 
       m = gPasses[i].close(a[i], m)
@@ -157,7 +134,8 @@ proc processModule(module: PSym, filename: string, stream: PLLStream,
         processTopLevelStmt(n, a)
       closeParsers(p)
       if s.kind != llsStdIn: break 
-    closePasses(a)            # id synchronization point for more consistent code generation:
+    closePasses(a)
+    # id synchronization point for more consistent code generation:
     IDsynchronizationPoint(1000)
   else: 
     openPassesCached(a, module, filename, rd)
diff --git a/rod/semexprs.nim b/rod/semexprs.nim
index 0a3c6e2ee..61823df32 100755
--- a/rod/semexprs.nim
+++ b/rod/semexprs.nim
@@ -388,7 +388,12 @@ proc analyseIfAddressTakenInCall(c: PContext, n: PNode) =
   checkMinSonsLen(n, 1)
   var t = n.sons[0].typ
   if (n.sons[0].kind == nkSym) and (n.sons[0].sym.magic in FakeVarParams): 
-    return 
+    # BUGFIX: check for L-Value still needs to be done for the arguments!
+    for i in countup(1, sonsLen(n) - 1): 
+      if i < sonsLen(t) and skipTypes(t.sons[i], abstractInst).kind == tyVar: 
+        if isAssignable(n.sons[i]) != arLValue: 
+          liMessage(n.sons[i].info, errVarForOutParamNeeded)
+    return
   for i in countup(1, sonsLen(n) - 1): 
     if (i < sonsLen(t)) and
         (skipTypes(t.sons[i], abstractInst).kind == tyVar): 
@@ -781,7 +786,7 @@ proc semArrayAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
 
 proc semIfExpr(c: PContext, n: PNode): PNode = 
   result = n
-  checkSonsLen(n, 2)
+  checkMinSonsLen(n, 2)
   var typ: PType = nil
   for i in countup(0, sonsLen(n) - 1): 
     var it = n.sons[i]
diff --git a/rod/sigmatch.nim b/rod/sigmatch.nim
index 2db387b95..b6f82f5c6 100755
--- a/rod/sigmatch.nim
+++ b/rod/sigmatch.nim
@@ -117,29 +117,26 @@ proc concreteType(mapping: TIdTable, t: PType): PType =
     result = t                # Note: empty is valid here
   
 proc handleRange(f, a: PType, min, max: TTypeKind): TTypeRelation = 
-  var k: TTypeKind
   if a.kind == f.kind: 
     result = isEqual
   else: 
-    k = skipTypes(a, {tyRange}).kind
+    var k = skipTypes(a, {tyRange}).kind
     if k == f.kind: result = isSubtype
     elif (f.kind == tyInt) and (k in {tyInt..tyInt32}): result = isIntConv
     elif (k >= min) and (k <= max): result = isConvertible
     else: result = isNone
   
 proc handleFloatRange(f, a: PType): TTypeRelation = 
-  var k: TTypeKind
   if a.kind == f.kind: 
     result = isEqual
   else: 
-    k = skipTypes(a, {tyRange}).kind
+    var k = skipTypes(a, {tyRange}).kind
     if k == f.kind: result = isSubtype
     elif (k >= tyFloat) and (k <= tyFloat128): result = isConvertible
     else: result = isNone
   
 proc isObjectSubtype(a, f: PType): bool = 
-  var t: PType
-  t = a
+  var t = a
   while (t != nil) and (t.id != f.id): t = base(t)
   result = t != nil
 
@@ -148,14 +145,11 @@ proc minRel(a, b: TTypeRelation): TTypeRelation =
   else: result = b
   
 proc tupleRel(mapping: var TIdTable, f, a: PType): TTypeRelation = 
-  var 
-    x, y: PSym
-    m: TTypeRelation
   result = isNone
   if sonsLen(a) == sonsLen(f): 
     result = isEqual
     for i in countup(0, sonsLen(f) - 1): 
-      m = typeRel(mapping, f.sons[i], a.sons[i])
+      var m = typeRel(mapping, f.sons[i], a.sons[i])
       if m < isSubtype: 
         return isNone
       result = minRel(result, m)
@@ -164,8 +158,8 @@ proc tupleRel(mapping: var TIdTable, f, a: PType): TTypeRelation =
         # check field names:
         if f.n.sons[i].kind != nkSym: InternalError(f.n.info, "tupleRel")
         if a.n.sons[i].kind != nkSym: InternalError(a.n.info, "tupleRel")
-        x = f.n.sons[i].sym
-        y = a.n.sons[i].sym
+        var x = f.n.sons[i].sym
+        var y = a.n.sons[i].sym
         if x.name.id != y.name.id: 
           return isNone
 
@@ -438,8 +432,7 @@ proc typeRel(mapping: var TIdTable, f, a: PType): TTypeRelation =
       case a.kind
       of tyExpr, tyStmt, tyTypeDesc: result = isGeneric
       of tyNil: result = isSubtype
-      else: 
-        nil
+      else: nil
   else: internalError("typeRel(" & $f.kind & ')')
   
 proc cmpTypes(f, a: PType): TTypeRelation = 
@@ -522,10 +515,6 @@ proc ParamTypesMatchAux(c: PContext, m: var TCandidate, f, a: PType,
   
 proc ParamTypesMatch(c: PContext, m: var TCandidate, f, a: PType, 
                      arg: PNode): PNode = 
-  var 
-    cmp, best: int
-    x, y, z: TCandidate
-    r: TTypeRelation
   if (arg == nil) or (arg.kind != nkSymChoice): 
     result = ParamTypesMatchAux(c, m, f, a, arg)
   else: 
@@ -533,18 +522,19 @@ proc ParamTypesMatch(c: PContext, m: var TCandidate, f, a: PType,
     # incorrect to simply use the first fitting match. However, to implement
     # this correctly is inefficient. We have to copy `m` here to be able to
     # roll back the side effects of the unification algorithm.
+    var x, y, z: TCandidate
     initCandidate(x, m.callee)
     initCandidate(y, m.callee)
     initCandidate(z, m.callee)
     x.calleeSym = m.calleeSym
     y.calleeSym = m.calleeSym
     z.calleeSym = m.calleeSym
-    best = - 1
+    var best = - 1
     for i in countup(0, sonsLen(arg) - 1): 
       # iterators are not first class yet, so ignore them
       if arg.sons[i].sym.kind in {skProc, skMethod, skConverter}: 
         copyCandidate(z, m)
-        r = typeRel(z.bindings, f, arg.sons[i].typ)
+        var r = typeRel(z.bindings, f, arg.sons[i].typ)
         if r != isNone: 
           case x.state
           of csEmpty, csNoMatch: 
@@ -552,7 +542,7 @@ proc ParamTypesMatch(c: PContext, m: var TCandidate, f, a: PType,
             best = i
             x.state = csMatch
           of csMatch: 
-            cmp = cmpCandidates(x, z)
+            var cmp = cmpCandidates(x, z)
             if cmp < 0: 
               best = i
               x = z
@@ -658,7 +648,7 @@ proc matches(c: PContext, n: PNode, m: var TCandidate) =
           return 
         m.baseTypeMatch = false
         var arg = ParamTypesMatch(c, m, formal.typ, n.sons[a].typ, n.sons[a])
-        if (arg == nil): 
+        if arg == nil: 
           m.state = csNoMatch
           return 
         if m.baseTypeMatch: 
@@ -677,9 +667,14 @@ proc matches(c: PContext, n: PNode, m: var TCandidate) =
     formal = m.callee.n.sons[f].sym
     if not IntSetContainsOrIncl(marker, formal.position): 
       if formal.ast == nil: 
-        # no default value
-        m.state = csNoMatch
-        break 
+        if formal.typ.kind == tyOpenArray:
+          container = newNodeI(nkBracket, n.info)
+          addSon(m.call, implicitConv(nkHiddenStdConv, formal.typ, 
+                                      container, m, c))
+        else:
+          # no default value
+          m.state = csNoMatch
+          break
       else: 
         # use default value:
         setSon(m.call, formal.position + 1, copyTree(formal.ast))
diff --git a/rod/syntaxes.nim b/rod/syntaxes.nim
index b8e4c1837..d757ad9f6 100755
--- a/rod/syntaxes.nim
+++ b/rod/syntaxes.nim
@@ -1,7 +1,7 @@
 #
 #
 #           The Nimrod Compiler
-#        (c) Copyright 2009 Andreas Rumpf
+#        (c) Copyright 2010 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
@@ -142,9 +142,9 @@ proc applyFilter(p: var TParsers, n: PNode, filename: string, stdin: PLLStream):
     result = filterReplace(stdin, filename, n)
   if f != filtNone: 
     if gVerbosity >= 2: 
-      rawMessage(hintCodeBegin)
+      rawMessage(hintCodeBegin, [])
       messageOut(result.s)
-      rawMessage(hintCodeEnd)
+      rawMessage(hintCodeEnd, [])
 
 proc evalPipe(p: var TParsers, n: PNode, filename: string, start: PLLStream): PLLStream = 
   result = start