diff options
author | Andreas Rumpf <andreas@andreas-desktop> | 2009-12-22 01:28:20 +0100 |
---|---|---|
committer | Andreas Rumpf <andreas@andreas-desktop> | 2009-12-22 01:28:20 +0100 |
commit | 2169fd63bdf9caf539ca7ca5b661ee703206500c (patch) | |
tree | e8d531ac9984699054744ad654c972acf5463062 /rod | |
parent | 9dda24e475bbdb3e33ae22d745bfaca552e18465 (diff) | |
download | Nim-2169fd63bdf9caf539ca7ca5b661ee703206500c.tar.gz |
version 0.8.6
Diffstat (limited to 'rod')
-rwxr-xr-x[-rw-r--r--] | rod/ast.nim | 7 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/ccgexprs.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/cgen.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/condsyms.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/evals.nim | 209 | ||||
-rwxr-xr-x | rod/nimrod.ini | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/nimrod.nim | 0 | ||||
-rwxr-xr-x | rod/nversion.nim | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/options.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/pbraces.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/pnimsyn.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/pragmas.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/rodread.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/rodwrite.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/sem.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/semdata.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/semfold.nim | 0 | ||||
-rwxr-xr-x | rod/semstmts.nim | 223 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/transf.nim | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | rod/trees.nim | 0 |
20 files changed, 181 insertions, 261 deletions
diff --git a/rod/ast.nim b/rod/ast.nim index 24ee4da5b..17e20dd2b 100644..100755 --- a/rod/ast.nim +++ b/rod/ast.nim @@ -355,8 +355,6 @@ type sym*: PSym of nkIdent: ident*: PIdent - of nkMetaNode: - nodePtr*: PNodePtr else: sons*: TNodeSeq @@ -885,7 +883,6 @@ proc copyNode(src: PNode): PNode = of nkSym: result.sym = src.sym of nkIdent: result.ident = src.ident of nkStrLit..nkTripleStrLit: result.strVal = src.strVal - of nkMetaNode: result.nodePtr = src.nodePtr else: nil proc copyTree(src: PNode): PNode = @@ -902,7 +899,6 @@ proc copyTree(src: PNode): PNode = of nkSym: result.sym = src.sym of nkIdent: result.ident = src.ident of nkStrLit..nkTripleStrLit: result.strVal = src.strVal - of nkMetaNode: result.nodePtr = src.nodePtr else: result.sons = nil newSons(result, sonsLen(src)) @@ -1018,8 +1014,7 @@ proc IntSetEnlarge(t: var TIntSet) = swap(t.data, n) proc IntSetPut(t: var TIntSet, key: int): PTrunk = - var h: int - h = key and t.max + var h = key and t.max while t.data[h] != nil: if t.data[h].key == key: return t.data[h] diff --git a/rod/ccgexprs.nim b/rod/ccgexprs.nim index aa6ec2ed0..aa6ec2ed0 100644..100755 --- a/rod/ccgexprs.nim +++ b/rod/ccgexprs.nim diff --git a/rod/cgen.nim b/rod/cgen.nim index 5399cdccf..5399cdccf 100644..100755 --- a/rod/cgen.nim +++ b/rod/cgen.nim diff --git a/rod/condsyms.nim b/rod/condsyms.nim index 0325a2b77..0325a2b77 100644..100755 --- a/rod/condsyms.nim +++ b/rod/condsyms.nim diff --git a/rod/evals.nim b/rod/evals.nim index 4c7b1df9d..bfc46aa5c 100644..100755 --- a/rod/evals.nim +++ b/rod/evals.nim @@ -84,7 +84,10 @@ proc stackTrace(c: PEvalContext, n: PNode, msg: TMsgKind, arg: string = "") = liMessage(n.info, msg, arg) proc isSpecial(n: PNode): bool = - result = (n.kind == nkExceptBranch) or (n.kind == nkEmpty) + result = (n.kind == nkExceptBranch) + # or (n.kind == nkEmpty) + # XXX this does not work yet! Better to compile too much than to compile to + # few programs proc evalIf(c: PEvalContext, n: PNode): PNode = var i = 0 @@ -131,7 +134,7 @@ proc evalWhile(c: PEvalContext, n: PNode): PNode = if result.sons[0] == nil: result = emptyNode # consume ``break`` token break - of nkExceptBranch, nkReturnToken, nkEmpty: + of nkExceptBranch, nkReturnToken: break else: nil @@ -247,7 +250,7 @@ proc evalCall(c: PEvalContext, n: PNode): PNode = if n.typ != nil: d.params[0] = getNullValue(n.typ, n.info) pushStackFrame(c, d) result = evalAux(c, prc) - if isSpecial(result): return + if result.kind == nkExceptBranch: return if n.typ != nil: result = d.params[0] popStackFrame(c) @@ -257,7 +260,9 @@ proc evalVariable(c: PStackFrame, sym: PSym): PNode = var x = c while x != nil: if sfResult in sym.flags: - return x.params[0] + result = x.params[0] + if result == nil: result = emptyNode + return result = IdNodeTableGet(x.mapping, sym) if result != nil: return x = x.next @@ -289,14 +294,11 @@ proc evalFieldAccess(c: PEvalContext, n: PNode): PNode = # a real field access; proc calls have already been # transformed # XXX: field checks! - var - x: PNode - field: PSym result = evalAux(c, n.sons[0]) if isSpecial(result): return - x = result + var x = result if x.kind != nkPar: InternalError(n.info, "evalFieldAccess") - field = n.sons[1].sym + var field = n.sons[1].sym for i in countup(0, sonsLen(n) - 1): if x.sons[i].kind != nkExprColonExpr: InternalError(n.info, "evalFieldAccess") @@ -306,10 +308,9 @@ proc evalFieldAccess(c: PEvalContext, n: PNode): PNode = result = emptyNode proc evalAsgn(c: PEvalContext, n: PNode): PNode = - var x: PNode result = evalAux(c, n.sons[0]) if isSpecial(result): return - x = result + var x = result result = evalAux(c, n.sons[1]) if isSpecial(result): return x.kind = result.kind @@ -328,15 +329,9 @@ proc evalAsgn(c: PEvalContext, n: PNode): PNode = result = emptyNode proc evalSwap(c: PEvalContext, n: PNode): PNode = - var - x: PNode - tmpi: biggestInt - tmpf: biggestFloat - tmps: string - tmpn: PNode result = evalAux(c, n.sons[0]) if isSpecial(result): return - x = result + var x = result result = evalAux(c, n.sons[1]) if isSpecial(result): return if (x.kind != result.kind): @@ -344,19 +339,19 @@ proc evalSwap(c: PEvalContext, n: PNode): PNode = else: case x.kind of nkCharLit..nkInt64Lit: - tmpi = x.intVal + var tmpi = x.intVal x.intVal = result.intVal result.intVal = tmpi of nkFloatLit..nkFloat64Lit: - tmpf = x.floatVal + var tmpf = x.floatVal x.floatVal = result.floatVal result.floatVal = tmpf of nkStrLit..nkTripleStrLit: - tmps = x.strVal + var tmps = x.strVal x.strVal = result.strVal result.strVal = tmps else: - tmpn = copyTree(x) + var tmpn = copyTree(x) discardSons(x) for i in countup(0, sonsLen(result) - 1): addSon(x, result.sons[i]) discardSons(result) @@ -375,13 +370,12 @@ proc evalSym(c: PEvalContext, n: PNode): PNode = if result == nil: stackTrace(c, n, errCannotInterpretNodeX, n.sym.name.s) proc evalIncDec(c: PEvalContext, n: PNode, sign: biggestInt): PNode = - var a, b: PNode result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result case a.kind of nkCharLit..nkInt64Lit: a.intval = a.intVal + sign * getOrdValue(b) else: internalError(n.info, "evalIncDec") @@ -466,16 +460,15 @@ proc evalUpConv(c: PEvalContext, n: PNode): PNode = stackTrace(c, n, errInvalidConversionFromTypeX, typeToString(src)) proc evalRangeChck(c: PEvalContext, n: PNode): PNode = - var x, a, b: PNode result = evalAux(c, n.sons[0]) if isSpecial(result): return - x = result + var x = result result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result if leValueConv(a, x) and leValueConv(x, b): result = x # a <= x and x <= b result.typ = n.typ @@ -494,11 +487,10 @@ proc evalConvCStrToStr(c: PEvalContext, n: PNode): PNode = result.typ = n.typ proc evalRaise(c: PEvalContext, n: PNode): PNode = - var a: PNode if n.sons[0] != nil: result = evalAux(c, n.sons[0]) if isSpecial(result): return - a = result + var a = result result = newNodeIT(nkExceptBranch, n.info, a.typ) addSon(result, a) c.lastException = result @@ -516,14 +508,18 @@ proc evalReturn(c: PEvalContext, n: PNode): PNode = result = newNodeIT(nkReturnToken, n.info, nil) proc evalProc(c: PEvalContext, n: PNode): PNode = - var v: PSym if n.sons[genericParamsPos] == nil: if (resultPos < sonsLen(n)) and (n.sons[resultPos] != nil): - v = n.sons[resultPos].sym + var v = n.sons[resultPos].sym result = getNullValue(v.typ, n.info) IdNodeTablePut(c.tos.mapping, v, result) - result = evalAux(c, n.sons[codePos]) - if result.kind == nkReturnToken: result = IdNodeTableGet(c.tos.mapping, v) + result = evalAux(c, n.sons[codePos]) + if result.kind == nkReturnToken: + result = IdNodeTableGet(c.tos.mapping, v) + else: + result = evalAux(c, n.sons[codePos]) + if result.kind == nkReturnToken: + result = emptyNode else: result = emptyNode @@ -541,51 +537,42 @@ proc evalIs(c: PEvalContext, n: PNode): PNode = result = newIntNodeT(ord(inheritanceDiff(result.typ, n.sons[2].typ) >= 0), n) proc evalSetLengthStr(c: PEvalContext, n: PNode): PNode = - var - a, b: PNode - oldLen, newLen: int result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result case a.kind of nkStrLit..nkTripleStrLit: - newLen = int(getOrdValue(b)) + var newLen = int(getOrdValue(b)) setlen(a.strVal, newLen) else: InternalError(n.info, "evalSetLengthStr") result = emptyNode proc evalSetLengthSeq(c: PEvalContext, n: PNode): PNode = - var - a, b: PNode - newLen, oldLen: int result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result if a.kind != nkBracket: InternalError(n.info, "evalSetLengthSeq") - newLen = int(getOrdValue(b)) - oldLen = sonsLen(a) + var newLen = int(getOrdValue(b)) + var oldLen = sonsLen(a) setlen(a.sons, newLen) for i in countup(oldLen, newLen - 1): a.sons[i] = getNullValue(skipTypes(n.sons[1].typ, abstractVar), n.info) result = emptyNode proc evalNewSeq(c: PEvalContext, n: PNode): PNode = - var - a, b: PNode - t: PType result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result - t = skipTypes(n.sons[1].typ, abstractVar) + var b = result + var t = skipTypes(n.sons[1].typ, abstractVar) if a.kind == nkEmpty: InternalError(n.info, "first parameter is empty") a.kind = nkBracket a.info = n.info @@ -601,38 +588,35 @@ proc evalAssert(c: PEvalContext, n: PNode): PNode = else: stackTrace(c, n, errAssertionFailed) proc evalIncl(c: PEvalContext, n: PNode): PNode = - var a, b: PNode result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result if not inSet(a, b): addSon(a, copyTree(b)) result = emptyNode proc evalExcl(c: PEvalContext, n: PNode): PNode = - var a, b, r: PNode result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = newNodeIT(nkCurly, n.info, n.sons[1].typ) + var b = newNodeIT(nkCurly, n.info, n.sons[1].typ) addSon(b, result) - r = diffSets(a, b) + var r = diffSets(a, b) discardSons(a) for i in countup(0, sonsLen(r) - 1): addSon(a, r.sons[i]) result = emptyNode proc evalAppendStrCh(c: PEvalContext, n: PNode): PNode = - var a, b: PNode result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result case a.kind of nkStrLit..nkTripleStrLit: add(a.strVal, chr(int(getOrdValue(b)))) else: InternalError(n.info, "evalAppendStrCh") @@ -640,10 +624,9 @@ proc evalAppendStrCh(c: PEvalContext, n: PNode): PNode = proc evalConStrStr(c: PEvalContext, n: PNode): PNode = # we cannot use ``evalOp`` for this as we can here have more than 2 arguments - var a: PNode result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result for i in countup(2, sonsLen(n) - 1): result = evalAux(c, n.sons[i]) if isSpecial(result): return @@ -651,26 +634,24 @@ proc evalConStrStr(c: PEvalContext, n: PNode): PNode = result = a proc evalAppendStrStr(c: PEvalContext, n: PNode): PNode = - var a, b: PNode result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result case a.kind of nkStrLit..nkTripleStrLit: a.strVal = a.strVal & getStrValue(b) else: InternalError(n.info, "evalAppendStrStr") result = emptyNode proc evalAppendSeqElem(c: PEvalContext, n: PNode): PNode = - var a, b: PNode result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result if a.kind == nkBracket: addSon(a, copyTree(b)) else: InternalError(n.info, "evalAppendSeqElem") result = emptyNode @@ -684,11 +665,7 @@ proc isEmpty(n: PNode): bool = result = (n != nil) and (n.kind == nkEmpty) proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = - var - m: TMagic - a, b, cc: PNode - k: biggestInt - m = getMagic(n) + var m = getMagic(n) case m of mNone: result = evalCall(c, n) of mIs: result = evalIs(c, n) @@ -714,7 +691,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNLen: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = newNodeIT(nkIntLit, n.info, n.typ) case a.kind of nkEmpty..nkNilLit: @@ -723,10 +700,10 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNChild: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - k = getOrdValue(result) + var k = getOrdValue(result) if not (a.kind in {nkEmpty..nkNilLit}) and (k >= 0) and (k < sonsLen(a)): result = a.sons[int(k)] if result == nil: result = newNode(nkEmpty) @@ -736,13 +713,13 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNSetChild: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result result = evalAux(c, n.sons[3]) if isSpecial(result): return - k = getOrdValue(b) + var k = getOrdValue(b) if (k >= 0) and (k < sonsLen(a)) and not (a.kind in {nkEmpty..nkNilLit}): if result.kind == nkEmpty: a.sons[int(k)] = nil else: a.sons[int(k)] = result @@ -752,7 +729,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNAdd: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return addSon(a, result) @@ -760,7 +737,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNAddMultiple: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return for i in countup(0, sonsLen(result) - 1): addSon(a, result.sons[i]) @@ -768,10 +745,10 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNDel: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result result = evalAux(c, n.sons[3]) if isSpecial(result): return for i in countup(0, int(getOrdValue(result)) - 1): @@ -780,13 +757,13 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNKind: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = newNodeIT(nkIntLit, n.info, n.typ) result.intVal = ord(a.kind) of mNIntVal: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = newNodeIT(nkIntLit, n.info, n.typ) case a.kind of nkCharLit..nkInt64Lit: result.intVal = a.intVal @@ -794,7 +771,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNFloatVal: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = newNodeIT(nkFloatLit, n.info, n.typ) case a.kind of nkFloatLit..nkFloat64Lit: result.floatVal = a.floatVal @@ -811,7 +788,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNStrVal: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = newNodeIT(nkStrLit, n.info, n.typ) case a.kind of nkStrLit..nkTripleStrLit: result.strVal = a.strVal @@ -819,7 +796,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNSetIntVal: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return a.intVal = result.intVal # XXX: exception handling? @@ -827,7 +804,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNSetFloatVal: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return a.floatVal = result.floatVal # XXX: exception handling? @@ -835,7 +812,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNSetSymbol: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return a.sym = result.sym # XXX: exception handling? @@ -843,7 +820,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNSetIdent: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return a.ident = result.ident # XXX: exception handling? @@ -851,7 +828,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNSetType: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return a.typ = result.typ # XXX: exception handling? @@ -859,7 +836,7 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNSetStrVal: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return a.strVal = result.strVal # XXX: exception handling? @@ -867,14 +844,14 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNNewNimNode: result = evalAux(c, n.sons[1]) if isSpecial(result): return - k = getOrdValue(result) + var k = getOrdValue(result) result = evalAux(c, n.sons[2]) - if isSpecial(result): return - a = result + if result.kind == nkExceptBranch: return + var a = result if (k < 0) or (k > ord(high(TNodeKind))): internalError(n.info, "request to create a NimNode with invalid kind") - if a.kind == nkNilLit: result = newNodeI(TNodeKind(int(k)), n.info) - else: result = newNodeI(TNodeKind(int(k)), a.info) + result = newNodeI(TNodeKind(int(k)), + if a.kind == nkNilLit: n.info else: a.info) of mNCopyNimNode: result = evalAux(c, n.sons[1]) if isSpecial(result): return @@ -888,33 +865,33 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = if isSpecial(result): return if not (result.kind in {nkStrLit..nkTripleStrLit}): InternalError(n.info, "no string node") - a = result + var a = result result = newNodeIT(nkIdent, n.info, n.typ) result.ident = getIdent(a.strVal) of mIdentToStr: result = evalAux(c, n.sons[1]) if isSpecial(result): return if result.kind != nkIdent: InternalError(n.info, "no ident node") - a = result + var a = result result = newNodeIT(nkStrLit, n.info, n.typ) result.strVal = a.ident.s of mEqIdent: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result result = newNodeIT(nkIntLit, n.info, n.typ) 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]) if isSpecial(result): return - a = result + var a = result result = evalAux(c, n.sons[2]) if isSpecial(result): return - b = result + var b = result result = newNodeIT(nkIntLit, n.info, n.typ) if (a == b) or (b.kind in {nkNilLit, nkEmpty}) and (a.kind in {nkNilLit, nkEmpty}): @@ -941,15 +918,15 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = of mNewString: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result + var a = result result = newNodeIT(nkStrLit, n.info, n.typ) result.strVal = newString(int(getOrdValue(a))) else: result = evalAux(c, n.sons[1]) if isSpecial(result): return - a = result - b = nil - cc = nil + var a = result + var b: PNode = nil + var cc: PNode = nil if sonsLen(n) > 2: result = evalAux(c, n.sons[2]) if isSpecial(result): return @@ -962,7 +939,6 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = else: result = evalOp(m, n, a, b, cc) proc evalAux(c: PEvalContext, n: PNode): PNode = - var a: PNode result = emptyNode dec(gNestedEvals) if gNestedEvals <= 0: stackTrace(c, n, errTooManyIterations) @@ -974,14 +950,14 @@ proc evalAux(c: PEvalContext, n: PNode): PNode = of nkCall, nkHiddenCallConv, nkMacroStmt, nkCommand, nkCallStrLit: result = evalMagicOrCall(c, n) of nkCurly, nkBracket, nkRange: - a = copyNode(n) + var a = copyNode(n) for i in countup(0, sonsLen(n) - 1): result = evalAux(c, n.sons[i]) if isSpecial(result): return addSon(a, result) result = a of nkPar: - a = copyTree(n) + var a = copyTree(n) for i in countup(0, sonsLen(n) - 1): result = evalAux(c, n.sons[i].sons[1]) if isSpecial(result): return @@ -1015,8 +991,7 @@ proc evalAux(c: PEvalContext, n: PNode): PNode = result = evalAux(c, n.sons[i]) case result.kind of nkExceptBranch, nkReturnToken, nkBreakStmt: break - else: - nil + else: nil of nkProcDef, nkMethodDef, nkMacroDef, nkCommentStmt, nkPragma, nkTypeSection, nkTemplateDef, nkConstSection, nkIteratorDef, nkConverterDef, nkIncludeStmt, nkImportStmt, nkFromStmt: diff --git a/rod/nimrod.ini b/rod/nimrod.ini index 98c520c63..e1b3d3bb2 100755 --- a/rod/nimrod.ini +++ b/rod/nimrod.ini @@ -39,6 +39,7 @@ Files: "*.nim" Files: "rod/readme.txt" Files: "rod/nimrod.ini" Files: "rod/nimrod.cfg" +Files: "rod/*.nim" Files: "build/empty.txt" Files: "bin/empty.txt" Files: "nim/*.*" diff --git a/rod/nimrod.nim b/rod/nimrod.nim index b5ed532c9..b5ed532c9 100644..100755 --- a/rod/nimrod.nim +++ b/rod/nimrod.nim diff --git a/rod/nversion.nim b/rod/nversion.nim index 9eb8cd117..8fbe87b07 100755 --- a/rod/nversion.nim +++ b/rod/nversion.nim @@ -15,6 +15,6 @@ const defaultAsmMarkerSymbol* = '!' VersionMajor* = 0 VersionMinor* = 8 - VersionPatch* = 5 + VersionPatch* = 6 VersionAsString* = $VersionMajor & "." & $VersionMinor & "." & $VersionPatch diff --git a/rod/options.nim b/rod/options.nim index 15bca38b6..15bca38b6 100644..100755 --- a/rod/options.nim +++ b/rod/options.nim diff --git a/rod/pbraces.nim b/rod/pbraces.nim index 4a5f85b85..4a5f85b85 100644..100755 --- a/rod/pbraces.nim +++ b/rod/pbraces.nim diff --git a/rod/pnimsyn.nim b/rod/pnimsyn.nim index 21980ccc4..21980ccc4 100644..100755 --- a/rod/pnimsyn.nim +++ b/rod/pnimsyn.nim diff --git a/rod/pragmas.nim b/rod/pragmas.nim index 72a6bd4e4..72a6bd4e4 100644..100755 --- a/rod/pragmas.nim +++ b/rod/pragmas.nim diff --git a/rod/rodread.nim b/rod/rodread.nim index ee295d122..ee295d122 100644..100755 --- a/rod/rodread.nim +++ b/rod/rodread.nim diff --git a/rod/rodwrite.nim b/rod/rodwrite.nim index 370ebc314..370ebc314 100644..100755 --- a/rod/rodwrite.nim +++ b/rod/rodwrite.nim diff --git a/rod/sem.nim b/rod/sem.nim index 2f9f90335..2f9f90335 100644..100755 --- a/rod/sem.nim +++ b/rod/sem.nim diff --git a/rod/semdata.nim b/rod/semdata.nim index 5020f103d..5020f103d 100644..100755 --- a/rod/semdata.nim +++ b/rod/semdata.nim diff --git a/rod/semfold.nim b/rod/semfold.nim index 455ddf2b8..455ddf2b8 100644..100755 --- a/rod/semfold.nim +++ b/rod/semfold.nim diff --git a/rod/semstmts.nim b/rod/semstmts.nim index c7dfc8466..415bb1a32 100755 --- a/rod/semstmts.nim +++ b/rod/semstmts.nim @@ -28,16 +28,16 @@ proc semWhen(c: PContext, n: PNode): PNode = result = semStmt(c, it.sons[0]) # do not open a new scope! else: illFormedAst(n) if result == nil: - result = newNodeI(nkNilLit, n.info) # The ``when`` statement implements the mechanism for platform dependant - # code. Thus we try to ensure here consistent ID allocation after the - # ``when`` statement. + result = newNodeI(nkNilLit, n.info) + # The ``when`` statement implements the mechanism for platform dependant + # code. Thus we try to ensure here consistent ID allocation after the + # ``when`` statement. IDsynchronizationPoint(200) proc semIf(c: PContext, n: PNode): PNode = - var it: PNode result = n for i in countup(0, sonsLen(n) - 1): - it = n.sons[i] + var it = n.sons[i] if it == nil: illFormedAst(n) case it.kind of nkElifBranch: @@ -58,19 +58,17 @@ proc semDiscard(c: PContext, n: PNode): PNode = n.sons[0] = semExprWithType(c, n.sons[0]) if n.sons[0].typ == nil: liMessage(n.info, errInvalidDiscard) -proc semBreakOrContinue(c: PContext, n: PNode): PNode = - var - s: PSym - x: PNode +proc semBreakOrContinue(c: PContext, n: PNode): PNode = result = n checkSonsLen(n, 1) if n.sons[0] != nil: + var s: PSym case n.sons[0].kind of nkIdent: s = lookUp(c, n.sons[0]) of nkSym: s = n.sons[0].sym else: illFormedAst(n) if (s.kind == skLabel) and (s.owner.id == c.p.owner.id): - x = newSymNode(s) + var x = newSymNode(s) x.info = n.info incl(s.flags, sfUsed) n.sons[0] = x @@ -80,13 +78,12 @@ proc semBreakOrContinue(c: PContext, n: PNode): PNode = liMessage(n.info, errInvalidControlFlowX, renderTree(n, {renderNoComments})) proc semBlock(c: PContext, n: PNode): PNode = - var labl: PSym result = n Inc(c.p.nestedBlockCounter) checkSonsLen(n, 2) openScope(c.tab) # BUGFIX: label is in the scope of block! if n.sons[0] != nil: - labl = newSymS(skLabel, n.sons[0], c) + var labl = newSymS(skLabel, n.sons[0], c) addDecl(c, labl) n.sons[0] = newSymNode(labl) # BUGFIX n.sons[1] = semStmt(c, n.sons[1]) @@ -109,7 +106,8 @@ proc semAsm(con: PContext, n: PNode): PNode = result = copyNode(n) str = n.sons[1].strVal if str == "": - liMessage(n.info, errEmptyAsm) # now parse the string literal and substitute symbols: + liMessage(n.info, errEmptyAsm) + # now parse the string literal and substitute symbols: a = 0 while true: b = strutils.find(str, marker, a) @@ -143,18 +141,13 @@ proc semWhile(c: PContext, n: PNode): PNode = closeScope(c.tab) proc semCase(c: PContext, n: PNode): PNode = - var - length: int - covered: biggestint # for some types we count to check if all cases have been covered - chckCovered: bool - x: PNode # check selector: result = n checkMinSonsLen(n, 2) openScope(c.tab) n.sons[0] = semExprWithType(c, n.sons[0]) - chckCovered = false - covered = 0 + var chckCovered = false + var covered: biggestint = 0 case skipTypes(n.sons[0].Typ, abstractVarRange).Kind of tyInt..tyInt64, tyChar, tyEnum: chckCovered = true @@ -162,12 +155,12 @@ proc semCase(c: PContext, n: PNode): PNode = nil else: liMessage(n.info, errSelectorMustBeOfCertainTypes) for i in countup(1, sonsLen(n) - 1): - x = n.sons[i] + var x = n.sons[i] case x.kind of nkOfBranch: checkMinSonsLen(x, 2) semCaseBranch(c, n, x, i, covered) - length = sonsLen(x) + var length = sonsLen(x) x.sons[length - 1] = semStmtScope(c, x.sons[length - 1]) of nkElifBranch: chckCovered = false @@ -313,8 +306,9 @@ proc semVar(c: PContext, n: PNode): PNode = if a.sons[length - 2] != nil: typ = semTypeNode(c, a.sons[length - 2], nil) else: typ = nil if a.sons[length - 1] != nil: - def = semExprWithType(c, a.sons[length - 1]) # BUGFIX: ``fitNode`` is needed here! - # check type compability between def.typ and typ: + def = semExprWithType(c, a.sons[length - 1]) + # BUGFIX: ``fitNode`` is needed here! + # check type compability between def.typ and typ: if (typ != nil): def = fitNode(c, typ, def) else: typ = def.typ else: @@ -369,7 +363,8 @@ proc semConst(c: PContext, n: PNode): PNode = v = semIdentWithPragma(c, skConst, a.sons[0], {}) if a.sons[1] != nil: typ = semTypeNode(c, a.sons[1], nil) else: typ = nil - def = semAndEvalConstExpr(c, a.sons[2]) # check type compability between def.typ and typ: + def = semAndEvalConstExpr(c, a.sons[2]) + # check type compability between def.typ and typ: if (typ != nil): def = fitRemoveHiddenConv(c, typ, def) else: @@ -397,7 +392,8 @@ proc semFor(c: PContext, n: PNode): PNode = length = sonsLen(n) openScope(c.tab) if n.sons[length - 2].kind == nkRange: - checkSonsLen(n.sons[length - 2], 2) # convert ``in 3..5`` to ``in countup(3, 5)`` + checkSonsLen(n.sons[length - 2], 2) + # convert ``in 3..5`` to ``in countup(3, 5)`` countupNode = newNodeI(nkCall, n.sons[length - 2].info) countUp = StrTableGet(magicsys.systemModule.Tab, getIdent("countup")) if (countUp == nil): liMessage(countupNode.info, errSystemNeeds, "countup") @@ -431,32 +427,27 @@ proc semFor(c: PContext, n: PNode): PNode = Dec(c.p.nestedLoopCounter) proc semRaise(c: PContext, n: PNode): PNode = - var typ: PType result = n checkSonsLen(n, 1) if n.sons[0] != nil: n.sons[0] = semExprWithType(c, n.sons[0]) - typ = n.sons[0].typ + var typ = n.sons[0].typ if (typ.kind != tyRef) or (typ.sons[0].kind != tyObject): liMessage(n.info, errExprCannotBeRaised) proc semTry(c: PContext, n: PNode): PNode = - var - length: int - a: PNode - typ: PType - check: TIntSet + var check: TIntSet result = n checkMinSonsLen(n, 2) n.sons[0] = semStmtScope(c, n.sons[0]) IntSetInit(check) for i in countup(1, sonsLen(n) - 1): - a = n.sons[i] + var a = n.sons[i] checkMinSonsLen(a, 1) - length = sonsLen(a) + var length = sonsLen(a) if a.kind == nkExceptBranch: for j in countup(0, length - 2): - typ = semTypeNode(c, a.sons[j], nil) + var typ = semTypeNode(c, a.sons[j], nil) if typ.kind == tyRef: typ = typ.sons[0] if (typ.kind != tyObject): liMessage(a.sons[j].info, errExprCannotBeRaised) @@ -465,26 +456,24 @@ proc semTry(c: PContext, n: PNode): PNode = if IntSetContainsOrIncl(check, typ.id): liMessage(a.sons[j].info, errExceptionAlreadyHandled) elif a.kind != nkFinally: - illFormedAst(n) # last child of an nkExcept/nkFinally branch is a statement: + illFormedAst(n) + # last child of an nkExcept/nkFinally branch is a statement: a.sons[length - 1] = semStmtScope(c, a.sons[length - 1]) proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode = - var - L: int - s: PSym - a, def: PNode - typ: PType result = copyNode(n) if n.kind != nkGenericParams: InternalError(n.info, "semGenericParamList") for i in countup(0, sonsLen(n) - 1): - a = n.sons[i] + var a = n.sons[i] if a.kind != nkIdentDefs: illFormedAst(n) - L = sonsLen(a) - def = a.sons[L - 1] + var L = sonsLen(a) + var def = a.sons[L - 1] + var typ: PType if a.sons[L - 2] != nil: typ = semTypeNode(c, a.sons[L - 2], nil) elif def != nil: typ = newTypeS(tyExpr, c) else: typ = nil for j in countup(0, L - 3): + var s: PSym if (typ == nil) or (typ.kind == tyTypeDesc): s = newSymS(skType, a.sons[j], c) s.typ = newTypeS(tyGenericParam, c) @@ -499,11 +488,10 @@ proc semGenericParamList(c: PContext, n: PNode, father: PType = nil): PNode = addDecl(c, s) proc addGenericParamListToScope(c: PContext, n: PNode) = - var a: PNode if n.kind != nkGenericParams: InternalError(n.info, "addGenericParamListToScope") for i in countup(0, sonsLen(n) - 1): - a = n.sons[i] + var a = n.sons[i] if a.kind != nkSym: internalError(a.info, "addGenericParamListToScope") addDecl(c, a.sym) @@ -512,8 +500,9 @@ proc SemTypeSection(c: PContext, n: PNode): PNode = s: PSym t, body: PType a: PNode - result = n # process the symbols on the left side for the whole type section, before - # we even look at the type definitions on the right + result = n + # process the symbols on the left side for the whole type section, before + # we even look at the type definitions on the right for i in countup(0, sonsLen(n) - 1): a = n.sons[i] if a.kind == nkCommentStmt: continue @@ -528,7 +517,8 @@ proc SemTypeSection(c: PContext, n: PNode): PNode = s.typ = newTypeS(tyForward, c) s.typ.sym = s # process pragmas: if a.sons[0].kind == nkPragmaExpr: - pragma(c, s, a.sons[0].sons[1], typePragmas) # add it here, so that recursive types are possible: + pragma(c, s, a.sons[0].sons[1], typePragmas) + # add it here, so that recursive types are possible: addInterfaceDecl(c, s) a.sons[0] = newSymNode(s) for i in countup(0, sonsLen(n) - 1): @@ -571,7 +561,8 @@ proc SemTypeSection(c: PContext, n: PNode): PNode = a = n.sons[i] if a.kind == nkCommentStmt: continue if (a.sons[0].kind != nkSym): IllFormedAst(a) - s = a.sons[0].sym # compute the type's size and check for illegal recursions: + s = a.sons[0].sym + # compute the type's size and check for illegal recursions: if a.sons[1] == nil: if (a.sons[2] != nil) and (a.sons[2].kind in {nkSym, nkIdent, nkAccQuoted}): @@ -592,9 +583,8 @@ proc addParams(c: PContext, n: PNode) = addDecl(c, n.sons[i].sym) proc semBorrow(c: PContext, n: PNode, s: PSym) = - var b: PSym # search for the correct alias: - b = SearchForBorrowProc(c, s, c.tab.tos - 2) + var b = SearchForBorrowProc(c, s, c.tab.tos - 2) if b == nil: liMessage(n.info, errNoSymbolToBorrowFromFound) # store the alias: n.sons[codePos] = newSymNode(b) @@ -605,9 +595,8 @@ proc sideEffectsCheck(c: PContext, s: PSym) = liMessage(s.info, errXhasSideEffects, s.name.s) proc addResult(c: PContext, t: PType, info: TLineInfo) = - var s: PSym if t != nil: - s = newSym(skVar, getIdent("result"), getCurrOwner()) + var s = newSym(skVar, getIdent("result"), getCurrOwner()) s.info = info s.typ = t incl(s.flags, sfResult) @@ -619,14 +608,11 @@ proc addResultNode(c: PContext, n: PNode) = if c.p.resultSym != nil: addSon(n, newSymNode(c.p.resultSym)) proc semLambda(c: PContext, n: PNode): PNode = - var - s: PSym - oldP: PProcCon result = n checkSonsLen(n, codePos + 1) - s = newSym(skProc, getIdent(":anonymous"), getCurrOwner()) + var s = newSym(skProc, getIdent(":anonymous"), getCurrOwner()) s.info = n.info - oldP = c.p # restore later + var oldP = c.p # restore later s.ast = n n.sons[namePos] = newSymNode(s) pushOwner(s) @@ -660,7 +646,6 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, validPragmas: TSpecialWords): PNode = var s, proto: PSym - oldP: PProcCon gp: PNode result = n checkSonsLen(n, codePos + 1) @@ -670,7 +655,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, else: s = semIdentVis(c, kind, n.sons[0], {}) n.sons[namePos] = newSymNode(s) - oldP = c.p # restore later + var oldP = c.p # restore later if sfStar in s.flags: incl(s.flags, sfInInterface) s.ast = n pushOwner(s) @@ -693,8 +678,9 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, if oldP.owner.kind != skModule: s.typ.callConv = ccClosure else: - s.typ.callConv = lastOptionEntry(c).defaultCC # add it here, so that recursive procs are possible: - # -2 because we have a scope open for parameters + s.typ.callConv = lastOptionEntry(c).defaultCC + # add it here, so that recursive procs are possible: + # -2 because we have a scope open for parameters if kind in OverloadableSyms: addInterfaceOverloadableSymAt(c, s, c.tab.tos - 2) else: @@ -745,12 +731,9 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, c.p = oldP # restore proc semIterator(c: PContext, n: PNode): PNode = - var - t: PType - s: PSym result = semProcAux(c, n, skIterator, iteratorPragmas) - s = result.sons[namePos].sym - t = s.typ + var s = result.sons[namePos].sym + var t = s.typ if t.sons[0] == nil: liMessage(n.info, errXNeedsReturnType, "iterator") if n.sons[codePos] == nil: liMessage(n.info, errImplOfXexpected, s.name.s) @@ -762,43 +745,34 @@ proc semMethod(c: PContext, n: PNode): PNode = result = semProcAux(c, n, skMethod, methodPragmas) proc semConverterDef(c: PContext, n: PNode): PNode = - var - t: PType - s: PSym if not isTopLevel(c): liMessage(n.info, errXOnlyAtModuleScope, "converter") checkSonsLen(n, codePos + 1) if n.sons[genericParamsPos] != nil: liMessage(n.info, errNoGenericParamsAllowedForX, "converter") result = semProcAux(c, n, skConverter, converterPragmas) - s = result.sons[namePos].sym - t = s.typ + var s = result.sons[namePos].sym + var t = s.typ if t.sons[0] == nil: liMessage(n.info, errXNeedsReturnType, "converter") if sonsLen(t) != 2: liMessage(n.info, errXRequiresOneArgument, "converter") addConverter(c, s) proc semMacroDef(c: PContext, n: PNode): PNode = - var - t: PType - s: PSym checkSonsLen(n, codePos + 1) if n.sons[genericParamsPos] != nil: liMessage(n.info, errNoGenericParamsAllowedForX, "macro") result = semProcAux(c, n, skMacro, macroPragmas) - s = result.sons[namePos].sym - t = s.typ + var s = result.sons[namePos].sym + var t = s.typ if t.sons[0] == nil: liMessage(n.info, errXNeedsReturnType, "macro") if sonsLen(t) != 2: liMessage(n.info, errXRequiresOneArgument, "macro") if n.sons[codePos] == nil: liMessage(n.info, errImplOfXexpected, s.name.s) proc evalInclude(c: PContext, n: PNode): PNode = - var - fileIndex: int - f: string result = newNodeI(nkStmtList, n.info) addSon(result, n) # the rodwriter needs include information! for i in countup(0, sonsLen(n) - 1): - f = getModuleFile(n.sons[i]) - fileIndex = includeFilename(f) + var f = getModuleFile(n.sons[i]) + var fileIndex = includeFilename(f) if IntSetContainsOrIncl(c.includedFiles, fileIndex): liMessage(n.info, errRecursiveDependencyX, f) addSon(result, semStmt(c, gIncludeFile(f))) @@ -806,26 +780,23 @@ proc evalInclude(c: PContext, n: PNode): PNode = proc semCommand(c: PContext, n: PNode): PNode = result = semExpr(c, n) - if result.typ != nil: liMessage(n.info, errDiscardValue) + if result.typ != nil and result.typ.kind != tyStmt: + liMessage(n.info, errDiscardValue) proc SemStmt(c: PContext, n: PNode): PNode = const # must be last statements in a block: LastBlockStmts = {nkRaiseStmt, nkReturnStmt, nkBreakStmt, nkContinueStmt} - var length: int result = n if n == nil: return if nfSem in n.flags: return case n.kind - of nkAsgn: - result = semAsgn(c, n) + of nkAsgn: result = semAsgn(c, n) of nkCall, nkInfix, nkPrefix, nkPostfix, nkCommand, nkMacroStmt, nkCallStrLit: result = semCommand(c, n) - of nkEmpty, nkCommentStmt, nkNilLit: - nil - of nkBlockStmt: - result = semBlock(c, n) + of nkEmpty, nkCommentStmt, nkNilLit: nil + of nkBlockStmt: result = semBlock(c, n) of nkStmtList: - length = sonsLen(n) + var length = sonsLen(n) for i in countup(0, length - 1): n.sons[i] = semStmt(c, n.sons[i]) if (n.sons[i].kind in LastBlockStmts): @@ -834,50 +805,28 @@ proc SemStmt(c: PContext, n: PNode): PNode = of nkPragma, nkCommentStmt, nkNilLit, nkEmpty: nil else: liMessage(n.sons[j].info, errStmtInvalidAfterReturn) - of nkRaiseStmt: - result = semRaise(c, n) - of nkVarSection: - result = semVar(c, n) - of nkConstSection: - result = semConst(c, n) - of nkTypeSection: - result = SemTypeSection(c, n) - of nkIfStmt: - result = SemIf(c, n) - of nkWhenStmt: - result = semWhen(c, n) - of nkDiscardStmt: - result = semDiscard(c, n) - of nkWhileStmt: - result = semWhile(c, n) - of nkTryStmt: - result = semTry(c, n) - of nkBreakStmt, nkContinueStmt: - result = semBreakOrContinue(c, n) - of nkForStmt: - result = semFor(c, n) - of nkCaseStmt: - result = semCase(c, n) - of nkReturnStmt: - result = semReturn(c, n) - of nkAsmStmt: - result = semAsm(c, n) - of nkYieldStmt: - result = semYield(c, n) - of nkPragma: - pragma(c, c.p.owner, n, stmtPragmas) - of nkIteratorDef: - result = semIterator(c, n) - of nkProcDef: - result = semProc(c, n) - of nkMethodDef: - result = semMethod(c, n) - of nkConverterDef: - result = semConverterDef(c, n) - of nkMacroDef: - result = semMacroDef(c, n) - of nkTemplateDef: - result = semTemplateDef(c, n) + of nkRaiseStmt: result = semRaise(c, n) + of nkVarSection: result = semVar(c, n) + of nkConstSection: result = semConst(c, n) + of nkTypeSection: result = SemTypeSection(c, n) + of nkIfStmt: result = SemIf(c, n) + of nkWhenStmt: result = semWhen(c, n) + of nkDiscardStmt: result = semDiscard(c, n) + of nkWhileStmt: result = semWhile(c, n) + of nkTryStmt: result = semTry(c, n) + of nkBreakStmt, nkContinueStmt: result = semBreakOrContinue(c, n) + of nkForStmt: result = semFor(c, n) + of nkCaseStmt: result = semCase(c, n) + of nkReturnStmt: result = semReturn(c, n) + of nkAsmStmt: result = semAsm(c, n) + of nkYieldStmt: result = semYield(c, n) + of nkPragma: pragma(c, c.p.owner, n, stmtPragmas) + of nkIteratorDef: result = semIterator(c, n) + of nkProcDef: result = semProc(c, n) + of nkMethodDef: result = semMethod(c, n) + of nkConverterDef: result = semConverterDef(c, n) + of nkMacroDef: result = semMacroDef(c, n) + of nkTemplateDef: result = semTemplateDef(c, n) of nkImportStmt: if not isTopLevel(c): liMessage(n.info, errXOnlyAtModuleScope, "import") result = evalImport(c, n) diff --git a/rod/transf.nim b/rod/transf.nim index 6bb825e13..6bb825e13 100644..100755 --- a/rod/transf.nim +++ b/rod/transf.nim diff --git a/rod/trees.nim b/rod/trees.nim index 69b77b8ab..69b77b8ab 100644..100755 --- a/rod/trees.nim +++ b/rod/trees.nim |