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

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: Rebase Created 6 years, 2 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 d56789a00c15c37b17c99feab145a3feb9c66967..b97938ac52dae25bd11aad0fb21dd0413c072efc 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