This commit is contained in:
Araq 2012-03-10 12:43:04 +01:00
commit e88123fb17
3 changed files with 11 additions and 9 deletions

View file

@ -87,7 +87,7 @@ proc semSym(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
result = newSymNode(s, n.info) result = newSymNode(s, n.info)
of skMacro: result = semMacroExpr(c, n, s) of skMacro: result = semMacroExpr(c, n, s)
of skTemplate: result = semTemplateExpr(c, n, s) of skTemplate: result = semTemplateExpr(c, n, s)
of skVar, skLet, skResult, skParam: of skVar, skLet, skResult, skParam, skForVar:
markUsed(n, s) markUsed(n, s)
# if a proc accesses a global variable, it is not side effect free: # if a proc accesses a global variable, it is not side effect free:
if sfGlobal in s.flags: if sfGlobal in s.flags:

View file

@ -407,6 +407,7 @@ proc semForVars(c: PContext, n: PNode): PNode =
if iter.kind != tyTuple or length == 3: if iter.kind != tyTuple or length == 3:
if length != 3: GlobalError(n.info, errWrongNumberOfVariables) if length != 3: GlobalError(n.info, errWrongNumberOfVariables)
var v = newSymS(skForVar, n.sons[0], c) 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 # BUGFIX: don't use `iter` here as that would strip away
# the ``tyGenericInst``! See ``tests/compile/tgeneric.nim`` # the ``tyGenericInst``! See ``tests/compile/tgeneric.nim``
# for an example: # for an example:
@ -418,6 +419,7 @@ proc semForVars(c: PContext, n: PNode): PNode =
GlobalError(n.info, errWrongNumberOfVariables) GlobalError(n.info, errWrongNumberOfVariables)
for i in countup(0, length - 3): for i in countup(0, length - 3):
var v = newSymS(skForVar, n.sons[i], c) var v = newSymS(skForVar, n.sons[i], c)
if getCurrOwner().kind == skModule: incl(v.flags, sfGlobal)
v.typ = iter.sons[i] v.typ = iter.sons[i]
n.sons[i] = newSymNode(v) n.sons[i] = newSymNode(v)
addDecl(c, v) addDecl(c, v)

View file

@ -19,7 +19,8 @@ version 0.9.0
- implement the high level optimizer - implement the high level optimizer
- change overloading resolution - change overloading resolution
- implement proper coroutines - 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 - we need to support iteration of 2 different data structures in parallel
- make exceptions compatible with C++ exceptions - make exceptions compatible with C++ exceptions
- 'const' objects including case objects - '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 changes that people want; may turn out to be a bad idea
- activate more thread tests - activate more thread tests
- optimize method dispatchers - 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 Bugs
---- ----
@ -168,11 +175,4 @@ Version 2
a generalized case statement looks like: a generalized case statement looks like:
case x with `=~` 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``