File tree 1 file changed +9
-1
lines changed
Sources/SwiftCompilerPluginMessageHandling/JSON
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ func encodeToJSON(value: some Encodable) throws -> [UInt8] {
17
17
}
18
18
19
19
/// Intermediate representation for serializing JSON structure.
20
- private class JSONReference {
20
+ private final class JSONReference {
21
21
enum Backing {
22
22
case null
23
23
case trueKeyword
@@ -60,9 +60,17 @@ private class JSONReference {
60
60
backing = . array( arr)
61
61
}
62
62
63
+ #if swift(>=6)
64
+ // nonisolated(unsafe) is fine for these properties because they represent primitives
65
+ // that are never modified.
66
+ nonisolated ( unsafe) static let null : JSONReference = . init( backing: . null)
67
+ nonisolated ( unsafe) static let trueKeyword : JSONReference = . init( backing: . trueKeyword)
68
+ nonisolated ( unsafe) static let falseKeyword : JSONReference = . init( backing: . falseKeyword)
69
+ #else
63
70
static let null : JSONReference = . init( backing: . null)
64
71
static let trueKeyword : JSONReference = . init( backing: . trueKeyword)
65
72
static let falseKeyword : JSONReference = . init( backing: . falseKeyword)
73
+ #endif
66
74
67
75
@inline ( __always)
68
76
static func newArray( ) -> JSONReference {
You can’t perform that action at this time.
0 commit comments