1.1 --- a/micropython/data.py Sun Jun 10 18:33:50 2012 +0200
1.2 +++ b/micropython/data.py Sun Jun 10 18:38:08 2012 +0200
1.3 @@ -871,8 +871,19 @@
1.4 if scope:
1.5 if not new_scope_usage.has_key(name):
1.6 new_scope_usage[name] = scope
1.7 - elif new_scope_usage[name] != scope:
1.8 - new_scope_usage[name] = ScopeConflict(scope, new_scope_usage[name])
1.9 + else:
1.10 + new_scope = new_scope_usage[name]
1.11 + if new_scope != scope:
1.12 + if isinstance(new_scope, ScopeConflict):
1.13 + if isinstance(scope, ScopeConflict):
1.14 + scopes = scope.scopes.union(new_scope.scopes)
1.15 + else:
1.16 + scopes = new_scope.scopes.union(set([scope]))
1.17 + elif isinstance(scope, ScopeConflict):
1.18 + scopes = scope.scopes.union(set([new_scope]))
1.19 + else:
1.20 + scopes = set([scope, new_scope])
1.21 + new_scope_usage[name] = ScopeConflict(scopes)
1.22
1.23 self.scope_usage[-1] = new_scope_usage
1.24
1.25 @@ -930,8 +941,8 @@
1.26 if scope_usage.has_key(name):
1.27 found_scope = scope_usage[name]
1.28 if isinstance(found_scope, ScopeConflict):
1.29 - raise InspectError("Scope conflict for %r: defined as both %s and %s." % (
1.30 - name, found_scope.old_scope, found_scope.new_scope))
1.31 + raise InspectError("Scope conflict for %r: defined as %s." % (
1.32 + name, ", ".join(found_scope.scopes)))
1.33
1.34 scope_usage[name] = scope
1.35
1.36 @@ -996,9 +1007,8 @@
1.37 sources of names.
1.38 """
1.39
1.40 - def __init__(self, old_scope, new_scope):
1.41 - self.old_scope = old_scope
1.42 - self.new_scope = new_scope
1.43 + def __init__(self, scopes):
1.44 + self.scopes = scopes
1.45
1.46 class NullBranch:
1.47