Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ private void printNativeEnum() {
if (!printPrivateDeclarations()) {
String swiftName = nameTable.getSwiftClassNameFromAnnotation(typeElement, true);
if (swiftName != null) {
if (typeNode instanceof EnumDeclaration) {
swiftName = swiftName + "_Enum";
}
printf(" NS_SWIFT_NAME(%s)", swiftName);
}
}
Expand Down Expand Up @@ -336,9 +339,6 @@ private void printSwiftName() {
String swiftName = nameTable.getSwiftClassNameFromAnnotation(typeElement, true);

if (swiftName != null) {
if (typeNode instanceof EnumDeclaration) {
swiftName = swiftName + "Class";
}
printf(" NS_SWIFT_NAME(%s)\n", swiftName);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1789,8 +1789,8 @@ public void testSwiftNameEnumAnnotation() throws IOException {
+ "@SwiftName "
+ "public enum Color { RED, WHITE, BLUE }";
String translation = translateSourceFile(sourceContent, "Color", "com/foo/bar/Color.h");
assertInTranslation(translation, "NS_SWIFT_NAME(Color_Enum)");
assertInTranslation(translation, "NS_SWIFT_NAME(Color)");
assertInTranslation(translation, "NS_SWIFT_NAME(ColorClass)");
}

public void testSwiftNameInterfaceSubtype() throws IOException {
Expand All @@ -1810,7 +1810,7 @@ public void testSwiftNameInterfaceSubtype() throws IOException {
+ " public final class NestedBar {}"
+ "}";
String translation = translateSourceFile(sourceContent, "FooBar", "com/foo/bar/FooBar.h");
assertInTranslation(translation, "NS_SWIFT_NAME(MyEnumClass)");
assertInTranslation(translation, "NS_SWIFT_NAME(MyEnum_Enum)");
assertInTranslation(translation, "NS_SWIFT_NAME(MyEnum)");
assertInTranslation(translation, "NS_SWIFT_NAME(NestedBar)");
}
Expand Down