summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xcompiler/semstmts.nim2
-rwxr-xr-xcompiler/transf.nim11
-rw-r--r--doc/trmacros.txt4
-rwxr-xr-xtodo.txt2
-rwxr-xr-xtools/niminst/niminst.nim2
5 files changed, 13 insertions, 8 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index b62f77888..193d6b7cf 100755
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1048,6 +1048,7 @@ proc instantiateDestructor*(c: PContext, typ: PType): bool =
       let fullDef = newNode(nkProcDef, i, @[
         newIdentNode(destructorName, i),
         emptyNode,
+        emptyNode,
         newNode(nkFormalParams, i, @[
           emptyNode,
           newNode(nkIdentDefs, i, @[
@@ -1056,6 +1057,7 @@ proc instantiateDestructor*(c: PContext, typ: PType): bool =
             emptyNode]),
           ]),
         newNode(nkPragma, i, @[destructorPragma]),
+        emptyNode,
         generated
         ])
       discard semProc(c, fullDef)
diff --git a/compiler/transf.nim b/compiler/transf.nim
index d5ffbfd65..170f8ff0f 100755
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -140,6 +140,7 @@ proc transformVarSection(c: PTransf, v: PNode): PTransNode =
       result[i] = PTransNode(it)
     elif it.kind == nkIdentDefs: 
       if it.sons[0].kind != nkSym: InternalError(it.info, "transformVarSection")
+      InternalAssert(it.len == 3)
       var newVar = copySym(it.sons[0].sym)
       incl(newVar.flags, sfFromGeneric)
       # fixes a strange bug for rodgen:
@@ -498,9 +499,13 @@ proc transformCase(c: PTransf, n: PNode): PTransNode =
     add(result, elseBranch)
   
 proc transformArrayAccess(c: PTransf, n: PNode): PTransNode = 
-  result = newTransNode(n)
-  result[0] = transform(c, skipConv(n.sons[0]))
-  result[1] = transform(c, skipConv(n.sons[1]))
+  # XXX this is really bad; transf should use a proper AST visitor
+  if n.sons[0].kind == nkSym and n.sons[0].sym.kind == skType:
+    result = n.ptransnode
+  else:
+    result = newTransNode(n)
+    for i in 0 .. < n.len:
+      result[i] = transform(c, skipConv(n.sons[i]))
   
 proc getMergeOp(n: PNode): PSym = 
   case n.kind
diff --git a/doc/trmacros.txt b/doc/trmacros.txt
index e138625f0..e740e6890 100644
--- a/doc/trmacros.txt
+++ b/doc/trmacros.txt
@@ -243,7 +243,7 @@ all the arguments, but also the matched operators in reverse polish notation:
       dummy: int
 
   proc `*`(a, b: TMatrix): TMatrix = nil
-  proc `+`(a, b: TMat): TMatrix = nil
+  proc `+`(a, b: TMatrix): TMatrix = nil
   proc `-`(a, b: TMatrix): TMatrix = nil
   proc `$`(a: TMatrix): string = result = $a.dummy
   proc mat21(): TMatrix =
@@ -257,7 +257,7 @@ all the arguments, but also the matched operators in reverse polish notation:
 
   echo x + y * z - x 
 
-This transforms passes expression ``x + y * z - x`` to the ``optM`` macro as
+This passes the expression ``x + y * z - x`` to the ``optM`` macro as
 an ``nnkArgList`` node containing::
 
   Arglist
diff --git a/todo.txt b/todo.txt
index 269338c63..e31e1cd49 100755
--- a/todo.txt
+++ b/todo.txt
@@ -2,8 +2,6 @@ version 0.9.0
 =============
 
 - make 'm: stmt' use overloading resolution
-- fix the 'nil' bug in the AST
-
 - make 'bind' default for templates and introduce 'mixin'
 
 - implicit deref for parameter matching
diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim
index f66bad1f4..f41ab665e 100755
--- a/tools/niminst/niminst.nim
+++ b/tools/niminst/niminst.nim
@@ -219,7 +219,7 @@ proc yesno(p: var TCfgParser, v: string): bool =
 proc parseIniFile(c: var TConfigData) =
   var
     p: TCfgParser
-    section: string # current section
+    section = ""
   var input = newFileStream(c.infile, fmRead)
   if input != nil:
     open(p, input, c.infile)