|
|
@@ -190,13 +190,8 @@ fileprivate func sanitizeTypeName(_ s: String, disambiguator: String) -> String
|
|
|
// conflict. This can be resolved recursively by stripping
|
|
|
// the disambiguator, sanitizing the root, then re-adding the
|
|
|
// disambiguator:
|
|
|
- #if swift(>=3.2)
|
|
|
- let e = s.index(s.endIndex, offsetBy: -disambiguator.count)
|
|
|
- let truncated = String(s[..<e])
|
|
|
- #else
|
|
|
- let e = s.index(s.endIndex, offsetBy: -disambiguator.characters.count)
|
|
|
- let truncated = s.substring(to: e)
|
|
|
- #endif
|
|
|
+ let e = s.index(s.endIndex, offsetBy: -disambiguator.count)
|
|
|
+ let truncated = String(s[..<e])
|
|
|
return sanitizeTypeName(truncated, disambiguator: disambiguator) + disambiguator
|
|
|
} else {
|
|
|
return s
|
|
|
@@ -302,12 +297,7 @@ public enum NamingUtils {
|
|
|
// "pacakge.some_name" -> "Package_SomeName"
|
|
|
var makeUpper = true
|
|
|
var prefix = ""
|
|
|
-#if swift(>=3.2)
|
|
|
- let protoPackageChars = protoPackage
|
|
|
-#else
|
|
|
- let protoPackageChars = protoPackage.characters
|
|
|
-#endif
|
|
|
- for c in protoPackageChars {
|
|
|
+ for c in protoPackage {
|
|
|
if c == "_" {
|
|
|
makeUpper = true
|
|
|
} else if c == "." {
|