forked from jasder/antlr
[Swift] Replace all uses of NSStringFromClass.
Bridging from NSString to String in Swift 5 is a transcoding operation, so it is expensive. Use String(describing:) instead of NSStringFromClass to avoid this cost.
This commit is contained in:
parent
10d182cf66
commit
a701f2b099
|
@ -668,7 +668,7 @@ public class PredictionContext: Hashable, CustomStringConvertible {
|
|||
}
|
||||
|
||||
public func toString<T>(_ recog: Recognizer<T>) -> String {
|
||||
return NSStringFromClass(PredictionContext.self)
|
||||
return String(describing: PredictionContext.self)
|
||||
// return toString(recog, ParserRuleContext.EMPTY);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,16 +54,16 @@ public class Transition {
|
|||
|
||||
public static let serializationTypes: Dictionary<String, Int> = [
|
||||
|
||||
NSStringFromClass(EpsilonTransition.self): EPSILON,
|
||||
NSStringFromClass(RangeTransition.self): RANGE,
|
||||
NSStringFromClass(RuleTransition.self): RULE,
|
||||
NSStringFromClass(PredicateTransition.self): PREDICATE,
|
||||
NSStringFromClass(AtomTransition.self): ATOM,
|
||||
NSStringFromClass(ActionTransition.self): ACTION,
|
||||
NSStringFromClass(SetTransition.self): SET,
|
||||
NSStringFromClass(NotSetTransition.self): NOT_SET,
|
||||
NSStringFromClass(WildcardTransition.self): WILDCARD,
|
||||
NSStringFromClass(PrecedencePredicateTransition.self): PRECEDENCE,
|
||||
String(describing: EpsilonTransition.self): EPSILON,
|
||||
String(describing: RangeTransition.self): RANGE,
|
||||
String(describing: RuleTransition.self): RULE,
|
||||
String(describing: PredicateTransition.self): PREDICATE,
|
||||
String(describing: AtomTransition.self): ATOM,
|
||||
String(describing: ActionTransition.self): ACTION,
|
||||
String(describing: SetTransition.self): SET,
|
||||
String(describing: NotSetTransition.self): NOT_SET,
|
||||
String(describing: WildcardTransition.self): WILDCARD,
|
||||
String(describing: PrecedencePredicateTransition.self): PRECEDENCE,
|
||||
|
||||
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue