Chromium Code Reviews| Index: mojo/public/tools/bindings/pylib/mojom/parse/translate.py |
| diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py |
| index c4798bf0679a2dceea28d371ad37fce709601f60..81806f177d6619a7bc0111f9b40b5e7a2f586e1c 100644 |
| --- a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py |
| +++ b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py |
| @@ -35,16 +35,24 @@ def _MapKind(kind): |
| 'handle<data_pipe_producer>': 'h:d:p', |
| 'handle<message_pipe>': 'h:m', |
| 'handle<shared_buffer>': 'h:s'} |
| + if kind.endswith('?'): |
| + decorated_kind = _MapKind(kind[0:-1]) |
| + # NOTE: This doesn't rule out enum types. Those will be detected later, when |
| + # cross-reference is established. |
| + if decorated_kind[0] not in ('s', 'h', 'a', 'r', 'x'): |
|
darin (slow to review)
2014/08/03 05:57:58
nit: might be nice to get this tuple a name, like
yzshen1
2014/08/03 08:27:46
Sounds good.
|
| + raise Exception( |
| + 'A type (spec "%s") cannot be made nullable' % decorated_kind) |
| + return '?' + decorated_kind |
| if kind.endswith('[]'): |
| typename = kind[0:-2] |
| if _FIXED_ARRAY_REGEXP.search(typename): |
| - raise Exception("Arrays of fixed sized arrays not supported") |
| + raise Exception('Arrays of fixed sized arrays not supported') |
| return 'a:' + _MapKind(typename) |
| if kind.endswith(']'): |
| lbracket = kind.rfind('[') |
| typename = kind[0:lbracket] |
| if typename.find('[') != -1: |
| - raise Exception("Fixed sized arrays of arrays not supported") |
| + raise Exception('Fixed sized arrays of arrays not supported') |
| return 'a' + kind[lbracket+1:-1] + ':' + _MapKind(typename) |
| if kind.endswith('&'): |
| return 'r:' + _MapKind(kind[0:-1]) |