probably half of the tests are running again.

This commit is contained in:
David Halter
2012-08-12 02:09:10 +02:00
parent 3ae7d3f278
commit 673cb30ee8
4 changed files with 25 additions and 5 deletions

View File

@@ -33,6 +33,7 @@ import dynamic
memoize_caches = []
statement_path = []
faked_scopes = []
class DecoratorNotFound(LookupError):
@@ -69,14 +70,14 @@ class MultiLevelAttributeError(Exception):
def clear_caches():
global memoize_caches
global statement_path
global memoize_caches, statement_path, faked_scopes
for m in memoize_caches:
m.clear()
memoize_caches = []
statement_path = []
faked_scopes = []
follow_statement.reset()
@@ -492,12 +493,14 @@ class Execution(Executable):
calls.keys = keys
calls.type = array_type
new_param = copy.copy(param)
new_param.parent = parent_stmt
if parent_stmt is not None:
new_param.parent = weakref.ref(parent_stmt)
new_param._assignment_calls_calculated = True
new_param._assignment_calls = calls
new_param.is_generated = True
name = copy.copy(param.get_name())
name.parent = weakref.ref(new_param)
faked_scopes.append(new_param)
return name
result = []
@@ -946,7 +949,6 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
and scope.var == name.parent().parent():
name = InstanceElement(scope.instance, name)
par = name.parent()
print name, par
if par.isinstance(parsing.Flow):
if par.command == 'for':
result += handle_for_loops(par)

View File

@@ -323,6 +323,7 @@ def set_debug_function(func_cb):
def _clear_caches():
evaluate.clear_caches()
import gc
return
#gc.set_debug(gc.DEBUG_STATS | gc.DEBUG_COLLECTABLE | gc.DEBUG_UNCOLLECTABLE | gc.DEBUG_OBJECTS)
#gc.collect()
count = 0

View File

@@ -4,6 +4,7 @@ import os
import pkgutil
import imp
import sys
import weakref
import builtin
import modules
@@ -61,7 +62,8 @@ class ImportPath(object):
zero = (None, None)
n = parsing.Name(i.namespace.names[1:], zero, zero)
new = parsing.Import(zero, zero, n)
new.parent = lambda: parent
new.parent = weakref.ref(parent)
evaluate.faked_scopes.append(new)
debug.dbg('Generated a nested import: %s' % new)
return new

View File

@@ -210,3 +210,18 @@ tuple(lst)[0]
# but not with an iterator
#?
iter(lst)[0]
# -----------------
# functions
# -----------------
def arr_append(arr, a):
arr.append(a)
def add_to_arr(arr, a):
arr.append(a)
return arr
a = [1.0]
#? int()
add_to_arr(a, 1)[0]