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

Unified Diff: mojo/public/tools/bindings/generators/mojom_python_generator.py

Issue 538613005: mojo: Start generating structs for python bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + fix constant array Created 6 years, 3 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/generators/mojom_python_generator.py
diff --git a/mojo/public/tools/bindings/generators/mojom_python_generator.py b/mojo/public/tools/bindings/generators/mojom_python_generator.py
index 88318b30589c3ef5ab768718391744a0edeca11c..9756576c16238ddfde9d729b9333a2a16c4ba8a4 100644
--- a/mojo/public/tools/bindings/generators/mojom_python_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_python_generator.py
@@ -35,6 +35,9 @@ def ConstantStyle(name):
return '_'.join([x.upper() for x in components])
def GetNameForElement(element):
+ if (mojom.IsEnumKind(element) or mojom.IsInterfaceKind(element) or
+ mojom.IsStructKind(element)):
+ return UpperCamelCase(element.name)
if isinstance(element, mojom.EnumValue):
return (GetNameForElement(element.enum) + '.' +
ConstantStyle(element.name))
@@ -129,6 +132,7 @@ class Generator(generator.Generator):
'imports': self.GetImports(),
'enums': self.module.enums,
'module': ComputeConstantValues(self.module),
+ 'structs': self.GetStructs(),
}
def GenerateFiles(self, args):

Powered by Google App Engine
This is Rietveld 408576698