Commit a9b94f08 authored by Kevin Modzelewski's avatar Kevin Modzelewski

The type analyzer now better supports closured variables

thanks Marius for the report
parent 423f0a7a
...@@ -384,6 +384,10 @@ private: ...@@ -384,6 +384,10 @@ private:
return UNKNOWN; return UNKNOWN;
} }
if (scope_info->refersToClosure(node->id)) {
return UNKNOWN;
}
CompilerType*& t = sym_table[node->id]; CompilerType*& t = sym_table[node->id];
if (t == NULL) { if (t == NULL) {
// if (VERBOSITY() >= 2) { // if (VERBOSITY() >= 2) {
......
x3 = 0
def bad_addr3(_x):
if 0:
x3 = _
def g(y3):
return x3 + y3
return g
print bad_addr3(1)(2)
...@@ -43,11 +43,9 @@ def make_addr3(x3): ...@@ -43,11 +43,9 @@ def make_addr3(x3):
return g return g
print make_addr3(10)(2) print make_addr3(10)(2)
def bad_addr3(_x): def f4(args):
if 0: def inner():
x3 = _ for a in args:
print a
def g(y3): return inner
return x3 + y3 print f4([1, 2, 3])()
return g
print bad_addr3(1)(2)
# expected: fail
# - deletes on names
x = 1
def f():
if 0:
# the del marks 'x' as a name written to in this scope
del x
print x
f()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment