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

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

Issue 1635613002: [mojo-bindings] Support reuse of native enum classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not generate validators for native-only enums 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_cpp_generator.py
diff --git a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
index eb2f03bd20f8696fafb4df23f6822932421a9dd6..c40b428fd28de6982d5c85f98236a7be58f0e93a 100644
--- a/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
+++ b/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
@@ -168,7 +168,11 @@ def GetCppArrayArgWrapperType(kind):
def GetCppResultWrapperType(kind):
if IsTypemappedKind(kind):
- return "const %s&" % GetNativeTypeName(kind)
+ if mojom.IsEnumKind(kind):
+ return GetNativeTypeName(kind)
+ else:
+ assert mojom.IsStructKind(kind)
+ return "const %s&" % GetNativeTypeName(kind)
if mojom.IsEnumKind(kind):
return GetNameForKind(kind)
if mojom.IsStructKind(kind) or mojom.IsUnionKind(kind):
@@ -242,7 +246,11 @@ def GetCppWrapperType(kind):
def GetCppConstWrapperType(kind):
if IsTypemappedKind(kind):
- return "const %s&" % GetNativeTypeName(kind)
+ if mojom.IsEnumKind(kind):
+ return GetNativeTypeName(kind)
+ else:
+ assert mojom.IsStructKind(kind)
+ return "const %s&" % GetNativeTypeName(kind)
if mojom.IsStructKind(kind) or mojom.IsUnionKind(kind):
return "%sPtr" % GetNameForKind(kind)
if mojom.IsArrayKind(kind):

Powered by Google App Engine
This is Rietveld 408576698