@@ -50,37 +50,36 @@ struct NameGenerator {
5050 /// - Parameter currentName: The current name which has to be checked.
5151 /// - Returns: New name for the variable.
5252 static func replaceKeywords( _ currentName: String ) -> String {
53-
5453 /// Swift keywords from https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID413 as of 2020-10-10
5554 /// Does not include the "sometimes" keywords
5655 /// Thanks to a PR from @TheMadBug.
5756 let swiftKeywords : Set = [
58- " associatedtype " , " class " , " deinit " ,
59- " enum " , " extension " , " fileprivate " ,
60- " func " , " import " , " init " ,
61- " inout " , " internal " , " let " ,
62- " open " , " operator " , " private " ,
63- " protocol " , " public " , " rethrows " ,
64- " static " , " struct " , " subscript " ,
65- " typealias " , " var " ,
66- " break " , " case " , " continue " ,
67- " default " , " defer " , " do " ,
68- " else " , " fallthrough " , " for " ,
69- " guard " , " if " , " in " ,
70- " repeat " , " return " , " switch " ,
71- " where " , " while " ,
72- " as " , " Any " , " catch " ,
73- " false " , " is " , " nil " ,
74- " super " , " self " , " Self " ,
75- " throw " , " throws " , " true " ,
76- " try "
77- ]
78-
57+ " associatedtype " , " class " , " deinit " ,
58+ " enum " , " extension " , " fileprivate " ,
59+ " func " , " import " , " init " ,
60+ " inout " , " internal " , " let " ,
61+ " open " , " operator " , " private " ,
62+ " protocol " , " public " , " rethrows " ,
63+ " static " , " struct " , " subscript " ,
64+ " typealias " , " var " ,
65+ " break " , " case " , " continue " ,
66+ " default " , " defer " , " do " ,
67+ " else " , " fallthrough " , " for " ,
68+ " guard " , " if " , " in " ,
69+ " repeat " , " return " , " switch " ,
70+ " where " , " while " ,
71+ " as " , " Any " , " catch " ,
72+ " false " , " is " , " nil " ,
73+ " super " , " self " , " Self " ,
74+ " throw " , " throws " , " true " ,
75+ " try " ,
76+ ]
77+
7978 var keywordsWithReplacements : [ String : String ] = [ : ]
8079 for keyword in swiftKeywords {
8180 keywordsWithReplacements [ keyword] = " \( keyword) Value "
8281 }
83-
82+
8483 if let value = keywordsWithReplacements [ currentName] {
8584 return value
8685 }
0 commit comments