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

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

Issue 437643002: Support nullable types in mojom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | mojo/public/tools/bindings/pylib/mojom/generate/module.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d7edaabf98ef0fbe9ce2c4de1a5e7365ed0bcdbf..dc130aa01eaf822e9de59b5b0cd699c004622b07 100644
--- a/mojo/public/tools/bindings/pylib/mojom/generate/data.py
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/data.py
@@ -99,20 +99,20 @@ def KindFromData(kinds, data, scope):
kind = LookupKind(kinds, data, scope)
if kind:
return kind
- if data.startswith('a:'):
- kind = mojom.Array()
- kind.kind = KindFromData(kinds, data[2:], scope)
+
+ if data.startswith('?'):
+ kind = KindFromData(kinds, data[1:], scope).MakeNullableKind()
+ elif data.startswith('a:'):
+ kind = mojom.Array(KindFromData(kinds, data[2:], scope))
elif data.startswith('r:'):
- kind = mojom.InterfaceRequest()
- kind.kind = KindFromData(kinds, data[2:], scope)
+ kind = mojom.InterfaceRequest(KindFromData(kinds, data[2:], scope))
elif data.startswith('a'):
colon = data.find(':')
length = int(data[1:colon])
- kind = mojom.FixedArray(length)
- kind.kind = KindFromData(kinds, data[colon+1:], scope)
+ kind = mojom.FixedArray(length, KindFromData(kinds, data[colon+1:], scope))
else:
- kind = mojom.Kind()
- kind.spec = data
+ kind = mojom.Kind(data)
+
kinds[data] = kind
return kind
« no previous file with comments | « no previous file | mojo/public/tools/bindings/pylib/mojom/generate/module.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698