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:
return UNKNOWN;
}
if (scope_info->refersToClosure(node->id)) {
return UNKNOWN;
}
CompilerType*& t = sym_table[node->id];
if (t == NULL) {
// 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):
return g
print make_addr3(10)(2)
def bad_addr3(_x):
if 0:
x3 = _
def g(y3):
return x3 + y3
return g
print bad_addr3(1)(2)
def f4(args):
def inner():
for a in args:
print a
return inner
print f4([1, 2, 3])()
# 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