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

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

Issue 268363003: Mojo: Add support for constants to the IDL compiler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: JS export constants 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 2300cb6f0381da79efca73960eae00f5b59a3725..e43cfd52243a5a633dfaad546d2ff3d11f39b2c5 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/translate.py
@@ -83,6 +83,7 @@ def _MapStruct(tree):
struct['attributes'] = _MapAttributes(tree[2])
struct['fields'] = _MapTree(_MapField, tree[3], 'FIELD')
struct['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM')
+ struct['constants'] = _MapTree(_MapConstant, tree[3], 'CONST')
return struct
def _MapInterface(tree):
@@ -91,6 +92,7 @@ def _MapInterface(tree):
interface['peer'] = _GetAttribute(tree[2], 'Peer')
interface['methods'] = _MapTree(_MapMethod, tree[3], 'METHOD')
interface['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM')
+ interface['constants'] = _MapTree(_MapConstant, tree[3], 'CONST')
return interface
def _MapEnum(tree):
@@ -99,6 +101,13 @@ def _MapEnum(tree):
enum['fields'] = _MapTree(_MapEnumField, tree[2], 'ENUM_FIELD')
return enum
+def _MapConstant(tree):
+ constant = {}
+ constant['name'] = tree[2]
+ constant['kind'] = _MapKind(tree[1])
+ constant['value'] = tree[3]
+ return constant
+
def _MapModule(tree, name):
mojom = {}
mojom['name'] = name
@@ -107,6 +116,7 @@ def _MapModule(tree, name):
mojom['structs'] = _MapTree(_MapStruct, tree[3], 'STRUCT')
mojom['interfaces'] = _MapTree(_MapInterface, tree[3], 'INTERFACE')
mojom['enums'] = _MapTree(_MapEnum, tree[3], 'ENUM')
+ mojom['constants'] = _MapTree(_MapConstant, tree[3], 'CONST')
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