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

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

Issue 611633002: mojom: Add associative arrays to the mojom language. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved test classes to their own shared file. 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/tools/bindings/pylib/mojom/generate/data.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/data.py b/mojo/public/tools/bindings/pylib/mojom/generate/data.py
index fab7e2e875b3ad5e13de2108ad55d2fd586ffdb5..829f3b24649ea22a861379b96c04e9d59130f593 100644
--- a/mojo/public/tools/bindings/pylib/mojom/generate/data.py
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/data.py
@@ -123,6 +123,12 @@ def KindFromData(kinds, data, scope):
kind = mojom.Array(KindFromData(kinds, data[2:], scope))
elif data.startswith('r:'):
kind = mojom.InterfaceRequest(KindFromData(kinds, data[2:], scope))
+ elif data.startswith('m['):
+ # Isolate the two types from their brackets
+ first_kind = data[2:data.find(']')]
+ second_kind = data[data.rfind('[')+1:data.rfind(']')]
+ kind = mojom.Map(KindFromData(kinds, first_kind, scope),
+ KindFromData(kinds, second_kind, scope))
elif data.startswith('a'):
colon = data.find(':')
length = int(data[1:colon])

Powered by Google App Engine
This is Rietveld 408576698