small bugfixes; reactivated tests/compile

This commit is contained in:
Araq 2012-09-11 23:21:02 +02:00
commit d48d3d0bd1
5 changed files with 13 additions and 8 deletions

View file

@ -1048,6 +1048,7 @@ proc instantiateDestructor*(c: PContext, typ: PType): bool =
let fullDef = newNode(nkProcDef, i, @[ let fullDef = newNode(nkProcDef, i, @[
newIdentNode(destructorName, i), newIdentNode(destructorName, i),
emptyNode, emptyNode,
emptyNode,
newNode(nkFormalParams, i, @[ newNode(nkFormalParams, i, @[
emptyNode, emptyNode,
newNode(nkIdentDefs, i, @[ newNode(nkIdentDefs, i, @[
@ -1056,6 +1057,7 @@ proc instantiateDestructor*(c: PContext, typ: PType): bool =
emptyNode]), emptyNode]),
]), ]),
newNode(nkPragma, i, @[destructorPragma]), newNode(nkPragma, i, @[destructorPragma]),
emptyNode,
generated generated
]) ])
discard semProc(c, fullDef) discard semProc(c, fullDef)

View file

@ -140,6 +140,7 @@ proc transformVarSection(c: PTransf, v: PNode): PTransNode =
result[i] = PTransNode(it) result[i] = PTransNode(it)
elif it.kind == nkIdentDefs: elif it.kind == nkIdentDefs:
if it.sons[0].kind != nkSym: InternalError(it.info, "transformVarSection") if it.sons[0].kind != nkSym: InternalError(it.info, "transformVarSection")
InternalAssert(it.len == 3)
var newVar = copySym(it.sons[0].sym) var newVar = copySym(it.sons[0].sym)
incl(newVar.flags, sfFromGeneric) incl(newVar.flags, sfFromGeneric)
# fixes a strange bug for rodgen: # fixes a strange bug for rodgen:
@ -498,9 +499,13 @@ proc transformCase(c: PTransf, n: PNode): PTransNode =
add(result, elseBranch) add(result, elseBranch)
proc transformArrayAccess(c: PTransf, n: PNode): PTransNode = proc transformArrayAccess(c: PTransf, n: PNode): PTransNode =
# 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) result = newTransNode(n)
result[0] = transform(c, skipConv(n.sons[0])) for i in 0 .. < n.len:
result[1] = transform(c, skipConv(n.sons[1])) result[i] = transform(c, skipConv(n.sons[i]))
proc getMergeOp(n: PNode): PSym = proc getMergeOp(n: PNode): PSym =
case n.kind case n.kind

View file

@ -243,7 +243,7 @@ all the arguments, but also the matched operators in reverse polish notation:
dummy: int dummy: int
proc `*`(a, b: TMatrix): TMatrix = nil 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, b: TMatrix): TMatrix = nil
proc `$`(a: TMatrix): string = result = $a.dummy proc `$`(a: TMatrix): string = result = $a.dummy
proc mat21(): TMatrix = proc mat21(): TMatrix =
@ -257,7 +257,7 @@ all the arguments, but also the matched operators in reverse polish notation:
echo x + y * z - x 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:: an ``nnkArgList`` node containing::
Arglist Arglist

View file

@ -2,8 +2,6 @@ version 0.9.0
============= =============
- make 'm: stmt' use overloading resolution - make 'm: stmt' use overloading resolution
- fix the 'nil' bug in the AST
- make 'bind' default for templates and introduce 'mixin' - make 'bind' default for templates and introduce 'mixin'
- implicit deref for parameter matching - implicit deref for parameter matching

View file

@ -219,7 +219,7 @@ proc yesno(p: var TCfgParser, v: string): bool =
proc parseIniFile(c: var TConfigData) = proc parseIniFile(c: var TConfigData) =
var var
p: TCfgParser p: TCfgParser
section: string # current section section = ""
var input = newFileStream(c.infile, fmRead) var input = newFileStream(c.infile, fmRead)
if input != nil: if input != nil:
open(p, input, c.infile) open(p, input, c.infile)