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

Unified Diff: mojo/public/tools/bindings/generators/python_templates/module.py.tmpl

Issue 551053002: mojo: Adding struct's fields for python bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding constructors. 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/python_templates/module.py.tmpl
diff --git a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl
index aa631d92fe6016ef5b2961f4efc27b6c929041d2..86ecf93104185592f4344ab9c2a5666db886ce74 100644
--- a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl
+++ b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import mojo.bindings.descriptor as _descriptor
import mojo.bindings.reflection as _reflection
{% if imports %}
@@ -42,5 +43,14 @@ class {{struct|name}}(object):
{% endfor %}
},
{% endif %}
+{% if struct.fields %}
+ 'fields': [
+{% for byte in struct.bytes %}
+{% for packed_field in byte.packed_fields %}
+ {{packed_field|field_descriptor}},
+{% endfor %}
+{% endfor %}
+ ],
+{% endif %}
}
{% endfor %}

Powered by Google App Engine
This is Rietveld 408576698