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

Unified Diff: third_party/WebKit/Source/bindings/scripts/idl_types.py

Issue 2719913002: bindings: Add idl_types.IdlRecordType. (Closed)
Patch Set: Add some tests to idl_types_test Created 3 years, 10 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: third_party/WebKit/Source/bindings/scripts/idl_types.py
diff --git a/third_party/WebKit/Source/bindings/scripts/idl_types.py b/third_party/WebKit/Source/bindings/scripts/idl_types.py
index 7447b56aba79ede4b9e2fad6aff39718fbabbf06..5cb0a791a791c93c2971681a3b9c783e01adef4b 100644
--- a/third_party/WebKit/Source/bindings/scripts/idl_types.py
+++ b/third_party/WebKit/Source/bindings/scripts/idl_types.py
@@ -452,6 +452,50 @@ class IdlFrozenArrayType(IdlArrayOrSequenceType):
################################################################################
+# IdlRecordType
+################################################################################
+
+class IdlRecordType(IdlTypeBase):
+ def __init__(self, key_type, value_type):
+ super(IdlRecordType, self).__init__()
+ self.key_type = key_type
+ self.value_type = value_type
+
+ def __str__(self):
+ return 'record<%s, %s>' % (self.key_type, self.value_type)
+
+ def __getstate__(self):
+ return {
+ 'key_type': self.key_type,
+ 'value_type': self.value_type,
+ }
+
+ def __setstate__(self, state):
+ self.key_type = state['key_type']
+ self.value_type = state['value_type']
+
+ def idl_types(self):
+ yield self
+ for idl_type in self.key_type.idl_types():
+ yield idl_type
+ for idl_type in self.value_type.idl_types():
+ yield idl_type
+
+ def resolve_typedefs(self, typedefs):
+ self.key_type = self.key_type.resolve_typedefs(typedefs)
+ self.value_type = self.value_type.resolve_typedefs(typedefs)
+ return self
+
+ @property
+ def is_record_type(self):
+ return True
+
+ @property
+ def name(self):
+ return self.key_type.name + self.value_type.name + 'Record'
+
+
+################################################################################
# IdlNullableType
################################################################################

Powered by Google App Engine
This is Rietveld 408576698