Skip to content
Snippets Groups Projects
Commit 0110ae78db25 authored by Sylvain's avatar Sylvain
Browse files

tryout: use a set to store variable refs, can't see why a list would be necessary

parent 636bef7fd229
No related branches found
No related tags found
No related merge requests found
......@@ -854,8 +854,7 @@
# main scope for this variable
'scope': None,
# link to VariableReference objects in the syntax tree
# it must be a list to keep order
'references': [],
'references': set(),
# relations where this variable is used on the lhs/rhs
'relations': set(),
'rhsrelations': set(),
......@@ -901,5 +900,5 @@
if not self.stinfo['possibletypes']:
self.stinfo['possibletypes'].update(old.stinfo['possibletypes'])
def register_reference(self, varref):
def register_reference(self, vref):
"""add a reference to this variable"""
......@@ -905,4 +904,3 @@
"""add a reference to this variable"""
assert not [v for v in self.stinfo['references'] if v is varref]
self.stinfo['references'].append(varref)
self.stinfo['references'].add(vref)
......@@ -908,3 +906,3 @@
def unregister_reference(self, varref):
def unregister_reference(self, vref):
"""remove a reference to this variable"""
......@@ -910,8 +908,5 @@
"""remove a reference to this variable"""
for i, _varref in enumerate(self.stinfo['references']):
if varref is _varref:
del self.stinfo['references'][i]
break
self.stinfo['references'].remove(vref)
def references(self):
"""return all references on this variable"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment