File tree Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Expand file tree Collapse file tree 2 files changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -110,16 +110,7 @@ BridgedDeclNameLoc_createParsed(BridgedSourceLoc cBaseNameLoc) {
110
110
111
111
BridgedIdentifier BridgedASTContext_getIdentifier (BridgedASTContext cContext,
112
112
BridgedStringRef cStr) {
113
- StringRef str = cStr.unbridged ();
114
- if (str.size () == 1 && str.front () == ' _' )
115
- return BridgedIdentifier ();
116
-
117
- // If this was a back-ticked identifier, drop the back-ticks.
118
- if (str.size () >= 2 && str.front () == ' `' && str.back () == ' `' ) {
119
- str = str.drop_front ().drop_back ();
120
- }
121
-
122
- return cContext.unbridged ().getIdentifier (str);
113
+ return cContext.unbridged ().getIdentifier (cStr.unbridged ());
123
114
}
124
115
125
116
bool BridgedASTContext_langOptsHasFeature (BridgedASTContext cContext,
Original file line number Diff line number Diff line change @@ -167,10 +167,14 @@ extension TokenSyntax {
167
167
/// - Parameter astgen: The visitor providing the `ASTContext`.
168
168
@inline ( __always)
169
169
func bridgedIdentifier( in astgen: ASTGenVisitor ) -> BridgedIdentifier {
170
- var text = self . text
171
- return text. withBridgedString { bridged in
172
- astgen. ctx. getIdentifier ( bridged)
170
+ var text = self . rawText
171
+ if rawText == " _ " {
172
+ return nil
173
+ }
174
+ if rawText. count > 2 && rawText. hasPrefix ( " ` " ) && rawText. hasSuffix ( " ` " ) {
175
+ text = . init( rebasing: text. dropFirst ( ) . dropLast ( ) )
173
176
}
177
+ return astgen. ctx. getIdentifier ( rawText. bridged)
174
178
}
175
179
176
180
/// Obtains a bridged, `ASTContext`-owned copy of this token's text, and its bridged start location in the
You can’t perform that action at this time.
0 commit comments