make sure to only escape an enum if the actual final variable name is going to match the enum name - now that we camelCase variable names this cuts down on the amount of enum escaping we have.

This commit is contained in:
Joseph Zuromski 2016-04-06 15:20:38 -07:00
parent c624311cab
commit b9bbbc6cad

View File

@ -332,9 +332,9 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
// 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)) { toVarName(name).equals(codegenProperty.datatypeWithEnum)) {
codegenProperty.datatypeWithEnum = escapeReservedWord(codegenProperty.datatypeWithEnum); codegenProperty.datatypeWithEnum = escapeReservedWord(codegenProperty.datatypeWithEnum);
} }
} }
return codegenProperty; return codegenProperty;
} }