Skip to content

Commit 92d7cf5

Browse files
Revised _tryToAppendKeyPaths(). Removed two instances of isPureStruct.append() that weren't needed.
1 parent 21f175a commit 92d7cf5

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

stdlib/public/core/KeyPath.swift

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2377,23 +2377,17 @@ internal func _tryToAppendKeyPaths<Result: AnyKeyPath>(
23772377
let typedRoot = unsafeDowncast(root, to: KeyPath<Root, Value>.self)
23782378
let typedLeaf = unsafeDowncast(leaf,
23792379
to: KeyPath<Value, AppendedValue>.self)
2380-
let result = _appendingKeyPaths(root: typedRoot, leaf: typedLeaf)
2380+
var result:AnyKeyPath = _appendingKeyPaths(root: typedRoot,
2381+
leaf: typedLeaf)
2382+
_processOffsetForAppendedKeyPath(appendedKeyPath: &result,
2383+
root: root, leaf: leaf)
23812384
return unsafeDowncast(result, to: Result.self)
23822385
}
23832386
return _openExistential(leafValue, do: open3)
23842387
}
23852388
return _openExistential(rootValue, do: open2)
23862389
}
2387-
var returnValue: AnyKeyPath = _openExistential(rootRoot, do: open)
2388-
_processOffsetForAppendedKeyPath(
2389-
appendedKeyPath: &returnValue,
2390-
root: root,
2391-
leaf: leaf
2392-
)
2393-
if let returnValue = returnValue as? Result {
2394-
return returnValue
2395-
}
2396-
return nil
2390+
return _openExistential(rootRoot, do: open)
23972391
}
23982392

23992393
@usableFromInline
@@ -3490,7 +3484,6 @@ internal struct InstantiateKeyPathBuffer: KeyPathPatternVisitor {
34903484
break
34913485
}
34923486
case .outOfLine(let offset):
3493-
isPureStruct.append(false)
34943487
let header = RawKeyPathComponent.Header(storedWithOutOfLineOffset: kind,
34953488
mutable: mutable)
34963489
pushDest(header)
@@ -3515,7 +3508,6 @@ internal struct InstantiateKeyPathBuffer: KeyPathPatternVisitor {
35153508
pushDest(header)
35163509
pushDest(offset)
35173510
case .unresolvedIndirectOffset(let pointerToOffset):
3518-
isPureStruct.append(false)
35193511
// Look up offset in the indirectly-referenced variable we have a
35203512
// pointer.
35213513
_internalInvariant(pointerToOffset.pointee <= UInt32.max)

0 commit comments

Comments
 (0)