Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: mojo/public/python/mojo/bindings/descriptor.py

Issue 622593002: mojo: Allow circular dependencies between structs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/python/mojo/bindings/descriptor.py
diff --git a/mojo/public/python/mojo/bindings/descriptor.py b/mojo/public/python/mojo/bindings/descriptor.py
index 9160736374f9ff73fb7286e1b857ab412a3f7b4e..1193721c364755d7610c4ed08ee6b699ce6c8fc5 100644
--- a/mojo/public/python/mojo/bindings/descriptor.py
+++ b/mojo/public/python/mojo/bindings/descriptor.py
@@ -372,11 +372,18 @@ class NativeArrayType(BaseArrayType):
class StructType(PointerType):
"""Type object for structs."""
- def __init__(self, struct_type, nullable=False):
+ def __init__(self, struct_type_getter, nullable=False):
PointerType.__init__(self)
- self.struct_type = struct_type
+ self._struct_type_getter = struct_type_getter
+ self._struct_type = None
self.nullable = nullable
+ @property
+ def struct_type(self):
+ if not self._struct_type:
+ self._struct_type = self._struct_type_getter()
+ return self._struct_type
+
def Convert(self, value):
if value is None or isinstance(value, self.struct_type):
return value

Powered by Google App Engine
This is Rietveld 408576698