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

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

Issue 262633005: Adding attributes to module and struct in mojom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix annotations Created 6 years, 7 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 | « 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 1a05e80aa668cea14bdcfae074688dbfb9029a0b..2300cb6f0381da79efca73960eae00f5b59a3725 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
@@ -37,6 +37,12 @@ def _MapKind(kind):
return map_to_kind[kind]
return 'x:' + kind
+def _MapAttributes(attributes):
+ if not attributes:
+ return {}
+ return dict([(attribute[1], attribute[2])
+ for attribute in attributes if attribute[0] == 'ATTRIBUTE'])
+
def _GetAttribute(attributes, name):
out = None
if attributes:
@@ -74,8 +80,7 @@ def _MapEnumField(tree):
def _MapStruct(tree):
struct = {}
struct['name'] = tree[1]
- # TODO(darin): Add support for |attributes|
- #struct['attributes'] = MapAttributes(tree[2])
+ struct['attributes'] = _MapAttributes(tree[2])
struct['fields'] = _MapTree(_MapField, tree[3], 'FIELD')
struct['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM')
return struct
@@ -98,9 +103,10 @@ def _MapModule(tree, name):
mojom = {}
mojom['name'] = name
mojom['namespace'] = tree[1]
- mojom['structs'] = _MapTree(_MapStruct, tree[2], 'STRUCT')
- mojom['interfaces'] = _MapTree(_MapInterface, tree[2], 'INTERFACE')
- mojom['enums'] = _MapTree(_MapEnum, tree[2], 'ENUM')
+ mojom['attributes'] = _MapAttributes(tree[2])
+ mojom['structs'] = _MapTree(_MapStruct, tree[3], 'STRUCT')
+ mojom['interfaces'] = _MapTree(_MapInterface, tree[3], 'INTERFACE')
+ mojom['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM')
return mojom
def _MapImport(tree):
« 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