提交 441a43cb authored 作者: Ricardo Vieira's avatar Ricardo Vieira 提交者: Ricardo Vieira

Speedup variable owner access

上级 1d5b1d94
...@@ -451,23 +451,7 @@ class Variable(Node, Generic[_TypeType, OptionalApplyType]): ...@@ -451,23 +451,7 @@ class Variable(Node, Generic[_TypeType, OptionalApplyType]):
# __slots__ = ['type', 'owner', 'index', 'name'] # __slots__ = ['type', 'owner', 'index', 'name']
__count__ = count(0) __count__ = count(0)
_owner: OptionalApplyType owner: OptionalApplyType
@property
def owner(self) -> OptionalApplyType:
return self._owner
@owner.setter
def owner(self, value) -> None:
self._owner = value
@property
def index(self):
return self._index
@index.setter
def index(self, value):
self._index = value
def __init__( def __init__(
self, self,
...@@ -482,7 +466,7 @@ class Variable(Node, Generic[_TypeType, OptionalApplyType]): ...@@ -482,7 +466,7 @@ class Variable(Node, Generic[_TypeType, OptionalApplyType]):
self.type = type self.type = type
self._owner = owner self.owner = owner
if owner is not None and not isinstance(owner, Apply): if owner is not None and not isinstance(owner, Apply):
raise TypeError("owner must be an Apply instance") raise TypeError("owner must be an Apply instance")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论