fixes #100
This commit is contained in:
parent
ff4a69b624
commit
e88123fb17
3 changed files with 11 additions and 9 deletions
|
|
@ -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:
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
|
|
||||||
16
todo.txt
16
todo.txt
|
|
@ -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
|
||||||
----
|
----
|
||||||
|
|
@ -169,10 +176,3 @@ Version 2
|
||||||
|
|
||||||
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``
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue