File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 26
26
27
27
SEMANTICS_ATTR (STRING_EQUALS, " string.equals" )
28
28
SEMANTICS_ATTR(STRING_MAKE_UTF8, " string.makeUTF8" )
29
+ SEMANTICS_ATTR(STRING_GET_UTF8_CSTRING, " string.getUTF8CString" )
29
30
SEMANTICS_ATTR(STRING_ESCAPE_PERCENT_GET, " string.escapePercent.get" )
30
31
SEMANTICS_ATTR(STRING_CONCAT, " string.concat" )
31
32
SEMANTICS_ATTR(STRING_APPEND, " string.append" )
Original file line number Diff line number Diff line change @@ -251,13 +251,16 @@ extension String {
251
251
/// }
252
252
/// // Prints "6"
253
253
public var utf8CString : ContiguousArray < CChar > {
254
- if _fastPath ( _guts. isFastUTF8) {
255
- var result = _guts. withFastCChar { ContiguousArray ( $0) }
256
- result. append ( 0 )
257
- return result
258
- }
254
+ @_effects ( readonly) @_semantics ( " string.getUTF8CString " )
255
+ get {
256
+ if _fastPath ( _guts. isFastUTF8) {
257
+ var result = _guts. withFastCChar { ContiguousArray ( $0) }
258
+ result. append ( 0 )
259
+ return result
260
+ }
259
261
260
- return _slowUTF8CString ( )
262
+ return _slowUTF8CString ( )
263
+ }
261
264
}
262
265
263
266
@usableFromInline @inline ( never) // slow-path
You can’t perform that action at this time.
0 commit comments