Merge pull request #2634 from yonaskolb/swift_enum_type

Append reserved swift enum type with "Enum"
This commit is contained in:
wing328 2016-04-19 16:38:06 +08:00
commit 3332692d30

View File

@ -340,9 +340,8 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
// Ensure that the enum type doesn't match a reserved word or // Ensure that the enum type doesn't match a reserved word or
// the variable name doesn't match the generated enum type or the // the variable name doesn't match the generated enum type or the
// Swift compiler will generate an error // Swift compiler will generate an error
if (isReservedWord(codegenProperty.datatypeWithEnum) || if (isReservedWord(codegenProperty.datatypeWithEnum) || name.equals(codegenProperty.datatypeWithEnum)) {
name.equals(codegenProperty.datatypeWithEnum)) { codegenProperty.datatypeWithEnum = codegenProperty.datatypeWithEnum + "Enum";
codegenProperty.datatypeWithEnum = escapeReservedWord(codegenProperty.datatypeWithEnum);
} }
} }
return codegenProperty; return codegenProperty;