You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -565,7 +567,7 @@ public protocol MacroConfigFileParserDelegate {
565
567
func endPreprocessorInclusion()
566
568
567
569
/// Invoked once for each macro value assignment. The `macroName` is guaranteed to be non-empty, but `value` may be empty. Any macro conditions are passed as tuples in the `conditions`; parameters are guaranteed to be non-empty strings, but patterns may be empty.
@@ -77,18 +80,23 @@ public struct MacroValueAssignmentTable: Serializable, Sendable {
77
80
78
81
79
82
/// Adds a mapping from `macro` to `value`, inserting it ahead of any already existing assignment for the same macro. Unless the value refers to the lower-precedence expression (using `$(inherited)` notation), any existing assignments are shadowed but not removed.
/// Adds a mapping from each of the macro-to-value mappings in `otherTable`, inserting them ahead of any already existing assignments in the receiving table. The other table isn’t affected in any way (in particular, no reference is kept from the receiver to the other table).
// We don't directly serialize MacroDeclarations, but rather serialize their contents "by hand" so when we deserialize we can re-use existing declarations in our namespace.
225
234
serializer.beginAggregate(valueAssignments.count)
@@ -247,6 +256,15 @@ public struct MacroValueAssignmentTable: Serializable, Sendable {
@@ -255,9 +273,10 @@ public struct MacroValueAssignmentTable: Serializable, Sendable {
255
273
guardlet delegate = deserializer.delegate as?(anyMacroValueAssignmentTableDeserializerDelegate)else{throwDeserializerError.invalidDelegate("delegate must be a MacroValueAssignmentTableDeserializerDelegate")}
256
274
self.namespace = delegate.namespace
257
275
self.valueAssignments =[:]
276
+
self.valueLocations =[:]
258
277
259
278
// Deserialize the table.
260
-
try deserializer.beginAggregate(1)
279
+
try deserializer.beginAggregate(2)
261
280
262
281
// Iterate over all the key-value pairs.
263
282
letcount:Int=try deserializer.beginAggregate()
@@ -304,6 +323,14 @@ public struct MacroValueAssignmentTable: Serializable, Sendable {
/// Private function that inserts a copy of the given linked list of MacroValueAssignments (starting at `srcAsgn`) in front of `dstAsgn` (which is optional). The order of the copies is the same as the order of the originals, and the last one will have `dstAsgn` as its `next` property. This function returns the copy that corresponds to `srcAsgn` so the client can add a reference to it wherever it sees fit.
/// We use a custom delegate to test that we’re getting the expected results, which for the sake of convenience are just kept in (name, conds:[(cond-param, cond-value)], value) tuples, i.e. conditions is an array of two-element tuples.
#expect(delegate.includeDirectivesCount == expectedIncludeDirectivesCount,"expected number of configs parsed to be \(expectedIncludeDirectivesCount), but instead got \(delegate.includeDirectivesCount)", sourceLocation: sourceLocation)
/// Private helper function that parses a string representation as either a string or a string list (depending on the parameter), and checks the resulting parser delegate method call sequence and diagnostics (if applicable) against what’s expected. This is a private function that’s called by the two internal test functions TestMacroStringParsing() and TestMacroStringListParsing(). The original file name and line number are passed in so that Xcode diagnostics will refer to the call site. Each diagnostic is provided by the unit test as a tuple containing the level, kind, and associated range (expressed as start and end “distances”, in the manner of Int.Distance, into the original string).
0 commit comments