diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index c97dc39632..e6e1f5b11f 100755 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -87,7 +87,7 @@ proc semSym(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode = result = newSymNode(s, n.info) of skMacro: result = semMacroExpr(c, n, s) of skTemplate: result = semTemplateExpr(c, n, s) - of skVar, skLet, skResult, skParam: + of skVar, skLet, skResult, skParam, skForVar: markUsed(n, s) # if a proc accesses a global variable, it is not side effect free: if sfGlobal in s.flags: diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index f761fd454d..bd69805b38 100755 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -407,6 +407,7 @@ proc semForVars(c: PContext, n: PNode): PNode = if iter.kind != tyTuple or length == 3: if length != 3: GlobalError(n.info, errWrongNumberOfVariables) var v = newSymS(skForVar, n.sons[0], c) + if getCurrOwner().kind == skModule: incl(v.flags, sfGlobal) # BUGFIX: don't use `iter` here as that would strip away # the ``tyGenericInst``! See ``tests/compile/tgeneric.nim`` # for an example: @@ -418,6 +419,7 @@ proc semForVars(c: PContext, n: PNode): PNode = GlobalError(n.info, errWrongNumberOfVariables) for i in countup(0, length - 3): var v = newSymS(skForVar, n.sons[i], c) + if getCurrOwner().kind == skModule: incl(v.flags, sfGlobal) v.typ = iter.sons[i] n.sons[i] = newSymNode(v) addDecl(c, v) diff --git a/todo.txt b/todo.txt index 2b4fdecaf1..f7a545e70c 100755 --- a/todo.txt +++ b/todo.txt @@ -19,7 +19,8 @@ version 0.9.0 - implement the high level optimizer - change overloading resolution - implement proper coroutines -- implement ``partial`` pragma for partial evaluation +- implement ``partial`` pragma for partial evaluation; ``hoist`` pragma for + loop hoisting - we need to support iteration of 2 different data structures in parallel - make exceptions compatible with C++ exceptions - 'const' objects including case objects @@ -28,6 +29,12 @@ version 0.9.0 changes that people want; may turn out to be a bad idea - activate more thread tests - optimize method dispatchers +- rethink the syntax: distinction between expr and stmt is unfortunate; + indentation handling is quite complex too; problem with exception handling + is that often the scope of ``try`` is wrong and apart from that ``try`` is + a full blown statement; a ``try`` expression might be a good idea to make + error handling more light-weight + people also want ``inc a; inc b`` Bugs ---- @@ -168,11 +175,4 @@ Version 2 a generalized case statement looks like: case x with `=~` - -- rethink the syntax: distinction between expr and stmt is unfortunate; - indentation handling is quite complex too; problem with exception handling - is that often the scope of ``try`` is wrong and apart from that ``try`` is - a full blown statement; a ``try`` expression might be a good idea to make - error handling more light-weight - people also want ``inc a; inc b``