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

Unified Diff: mojo/public/tools/bindings/pylib/mojom/generate/module.py

Issue 611633002: mojom: Add associative arrays to the mojom language. (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/tools/bindings/pylib/mojom/generate/module.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/module.py b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
index 238f060fb6ac4eba91a4670c548ab0aaefefa1db..ad6950a967045db60d7acd82d19b62a84f63218d 100644
--- a/mojo/public/tools/bindings/pylib/mojom/generate/module.py
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
@@ -228,6 +228,17 @@ class FixedArray(ReferenceKind):
self.length = length
+class Map(ReferenceKind):
+ ReferenceKind.AddSharedProperty('key_kind')
+ ReferenceKind.AddSharedProperty('value_kind')
+
+ def __init__(self, key_kind, value_kind):
+ ReferenceKind.__init__(self,
+ 'm[' + key_kind.spec + '][' + value_kind.spec + ']')
+ self.key_kind = key_kind
+ self.value_kind = value_kind
+
+
class InterfaceRequest(ReferenceKind):
ReferenceKind.AddSharedProperty('kind')
@@ -399,9 +410,13 @@ def IsAnyArrayKind(kind):
return IsArrayKind(kind) or IsFixedArrayKind(kind)
-def IsObjectKind(kind):
- return IsStructKind(kind) or IsAnyArrayKind(kind) or IsStringKind(kind)
+def IsMapKind(kind):
+ return isinstance(kind, Map)
+
+def IsObjectKind(kind):
+ return (IsStructKind(kind) or IsAnyArrayKind(kind) or IsStringKind(kind) or
+ IsMapKind(kind))
def IsNonInterfaceHandleKind(kind):
return (IsHandleKind(kind) or

Powered by Google App Engine
This is Rietveld 408576698