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

Unified Diff: mojo/public/tools/bindings/pylib/mojom/generate/module.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
Index: mojo/public/tools/bindings/pylib/mojom/generate/module.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/module.py b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
index 9d04add87d1159d05a8a04c8edbe05fcceddac61..fa55417dd583604697730ac2e9a58458f6a78668 100644
--- a/mojo/public/tools/bindings/pylib/mojom/generate/module.py
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/module.py
@@ -60,18 +60,31 @@ PRIMITIVES = (
)
-class Constant(object):
- def __init__(self, module, enum, field):
+class NamedValue(object):
+ def __init__(self, module, parent_kind, name):
self.module = module
self.namespace = module.namespace
- self.parent_kind = enum.parent_kind
- self.name = [enum.name, field.name]
+ self.parent_kind = parent_kind
+ self.name = name
self.imported_from = None
def GetSpec(self):
return (self.namespace + '.' +
- (self.parent_kind and (self.parent_kind.name + '.') or "") + \
- self.name[1])
+ (self.parent_kind and (self.parent_kind.name + '.') or "") +
+ self.name)
+
+
+class EnumValue(NamedValue):
+ def __init__(self, module, enum, field):
+ NamedValue.__init__(self, module, enum.parent_kind, field.name)
+ self.enum_name = enum.name
+
+
+class Constant(object):
+ def __init__(self, name=None, kind=None, value=None):
+ self.name = name
+ self.kind = kind
+ self.value = value
class Field(object):
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/generate/data.py ('k') | mojo/public/tools/bindings/pylib/mojom/parse/lexer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698