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

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

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: All Short Names use unsafe GetElementForName Created 4 years, 11 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_go_generator.py
diff --git a/mojo/public/tools/bindings/generators/mojom_go_generator.py b/mojo/public/tools/bindings/generators/mojom_go_generator.py
index 709bcc63021f56a760456e6ecd685cb958143aac..b6f6074dca5afce11f0fd8ce66eca9e72d52ad85 100644
--- a/mojo/public/tools/bindings/generators/mojom_go_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_go_generator.py
@@ -307,8 +307,9 @@ def AddImport(imports, mojom_imports, module, element):
imports[path] = name
mojom_imports[path] = name
-def GetIdentifier(kind):
- """Use the kind's module to determine the package and name."""
+# Get the mojom type's identifier suffix.
+def GetMojomTypeIdentifier(kind):
+ """Get the mojom type's unique identifier from the kind's package and name."""
# Note: InterfaceRequest's should use the Interface inside them.
if hasattr(kind, 'module'):
package = GetPackageName(kind.module)
@@ -319,13 +320,7 @@ def GetIdentifier(kind):
else:
# These kinds (e.g., simple kinds, maps, and arrays) lack identifiers.
raise Exception('Unexpected kind: %s' % kind)
-
- return '%s_%s' % (package, name)
-
-# Get the mojom type's identifier suffix.
-def GetMojomTypeIdentifier(kind):
- # Since this should be unique, it is based on the type's identifier.
- return "%s__" % GetIdentifier(kind)
+ return "%s_%s__" % (package, name)
class Generator(generator.Generator):
go_filters = {
@@ -336,7 +331,6 @@ class Generator(generator.Generator):
'go_type': GetGoType,
'expression_to_text': ExpressionToText,
'has_response': lambda method: method.response_parameters is not None,
- 'identifier': GetIdentifier,
'is_array': mojom.IsArrayKind,
'is_enum': mojom.IsEnumKind,
'is_handle': mojom.IsAnyHandleKind,

Powered by Google App Engine
This is Rietveld 408576698