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

Unified Diff: mojo/public/tools/bindings/pylib/mojom/parse/translate.py

Issue 1515423002: [mojo] Add mojom parser support for native-only structs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pickle2
Patch Set: oops Created 5 years 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 | « mojo/public/tools/bindings/pylib/mojom/parse/parser.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aad245fdc2ebb5182b276735807424e32119c261..e457f994b0acd7d7913a7b5422dd08b9d21af37b 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
@@ -130,12 +130,15 @@ class _MojomBuilder(object):
assert isinstance(struct, ast.Struct)
data = {'name': struct.name,
- 'fields': _MapTreeForType(StructFieldToDict, struct.body,
- ast.StructField, struct.name),
- 'enums': _MapTreeForType(_EnumToDict, struct.body, ast.Enum,
- struct.name),
- 'constants': _MapTreeForType(_ConstToDict, struct.body,
- ast.Const, struct.name)}
+ 'native_only': struct.body is None}
+ if not data['native_only']:
+ data.update({
+ 'fields': _MapTreeForType(StructFieldToDict, struct.body,
+ ast.StructField, struct.name),
+ 'enums': _MapTreeForType(_EnumToDict, struct.body, ast.Enum,
+ struct.name),
+ 'constants': _MapTreeForType(_ConstToDict, struct.body,
+ ast.Const, struct.name)})
_AddOptional(data, 'attributes',
_AttributeListToDict(struct.attribute_list))
return data
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/parse/parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698