Commit 84ea02c8 authored by Xavier Thompson's avatar Xavier Thompson

Take cypclass locking mode into account for automatic lock acquisition

parent 510e786b
......@@ -445,9 +445,15 @@ class CypclassLockTransform(Visitor.EnvTransform):
error(lock.pos, "A writelock is required, but a readlock is manually acquired")
return obj
except:
self.autolocks += 1
self.autowlocks += exclusive
return ExprNodes.CoerceToLockedNode(obj, self.current_env(), rlock_only = not exclusive)
lock_mode = obj.type.lock_mode
if lock_mode == "autolock":
self.autolocks += 1
self.autowlocks += exclusive
return ExprNodes.CoerceToLockedNode(obj, self.current_env(), rlock_only = not exclusive)
elif lock_mode == "checklock":
msg = "Reference '%s' is not correctly locked in this expression (%s lock required)"
error(obj.pos, msg % (obj.name, "write" if exclusive else "read"))
return obj
def __call__(self, root):
self.locked = {}
......
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