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 |