We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents dda63e4 + a982b62 commit ad4a715Copy full SHA for ad4a715
Sources/GraphQL/Language/Source.swift
@@ -3,13 +3,19 @@
3
* but is mostly useful for clients who store GraphQL documents in
4
* source files; for example, if the GraphQL input is in a file Foo.graphql,
5
* it might be useful for name to be "Foo.graphql".
6
+ *
7
+ * Note that since Source parsing is heavily UTF8 dependent, the body
8
+ * is converted into contiguous UTF8 bytes if necessary for optimal performance.
9
*/
10
public struct Source {
11
public let body: String
12
public let name: String
13
14
public init(body: String, name: String = "GraphQL") {
- self.body = body
15
+ var utf8Body = body
16
+ utf8Body.makeContiguousUTF8()
17
+
18
+ self.body = utf8Body
19
self.name = name
20
}
21
0 commit comments