| 1 |
extension Character : _ExpressibleByBuiltinExtendedGraphemeClusterLiteral, ExpressibleByExtendedGraphemeClusterLiteral { @inlinable @inline(__always) public init(_ content: Unicode.Scalar) { self.init(unchecked: String(content)) } @inlinable @inline(__always) @_effects(readonly) public init(_builtinUnicodeScalarLiteral value: Builtin.Int32) { self.init(Unicode.Scalar(_builtinUnicodeScalarLiteral: value)) } |
| 2 |
extension Character { @usableFromInline @testable internal var _isSmall: Bool { return _str._guts.isSmall } } |
| 3 |
extension Character: Hashable { @_effects(releasenone) public func hash(into hasher: inout Hasher) { _str.hash(into: &hasher) } } |
| 4 |
extension Character: Hashable { @_effects(releasenone) public func hash(into hasher: inout Hasher) { _str.hash(into: &hasher) } } |
| 5 |
extension Character: Comparable { @inlinable @inline(__always) @_effects(readonly) public static func < (lhs: Character, rhs: Character) -> Bool { return lhs._str < rhs._str } } |
| 6 |
extension Character: Equatable { @inlinable @inline(__always) @_effects(readonly) public static func == (lhs: Character, rhs: Character) -> Bool { return lhs._str == rhs._str } } |
| 7 |
extension Character: CustomStringConvertible { @inlinable public var description: String { return _str } } |
| 8 |
@inlinable @inline(__always) public init(_ s: String) { _precondition(!s.isEmpty, "Can't form a Character from an empty String") _debugPrecondition(s.index(after: s.startIndex) == s.endIndex, "Can't form a Character from a String containing more than one extended grapheme cluster") |
| 9 |
if _fastPath(s._guts._object.isPreferredRepresentation) { self.init(unchecked: s) return } self.init(unchecked: String._copying(s)) } } @_transparent @inline(__always) public static func && (lhs: Bool, rhs: @autoclosure () throws -> Bool) rethrows -> Bool { return lhs ? try rhs() : false } |
| 10 |
@inlinable @inline(__always) internal mutating func finishWithOriginalCount() -> ContiguousArray<Element> { _internalInvariant(remainingCapacity == result.capacity - result.count, "_UnsafePartiallyInitializedContiguousArrayBuffer has incorrect count") var finalResult = _ContiguousArrayBuffer<Element>() (finalResult, result) = (result, finalResult) remainingCapacity = 0 finalResult.endCOWMutation() return ContiguousArray(_buffer: finalResult) } |
| 11 |
@inlinable @inline(__always) internal mutating func finish() -> ContiguousArray<Element> { if (result.capacity != 0) { result.mutableCount = result.capacity - remainingCapacity } else { _internalInvariant(remainingCapacity == 0) _internalInvariant(result.count == 0) } return finishWithOriginalCount() } |
| 12 |
@inlinable @inline(__always) internal mutating func add(_ element: Element) { if remainingCapacity == 0 { let newCapacity = max(_growArrayCapacity(result.capacity), 1) var newResult = _ContiguousArrayBuffer<Element>( _uninitializedCount: newCapacity, minimumCapacity: 0) p = newResult.firstElementAddress + result.capacity remainingCapacity = newResult.capacity - result.capacity if !result.isEmpty { newResult.firstElementAddress.moveInitialize( from: result.firstElementAddress, count: result.capacity) result.mutableCount = 0 } (result, newResult) = (newResult, result) } addWithExistingCapacity(element) } |
| 13 |
@inlinable public __consuming func drop( while predicate: (Element) throws -> Bool ) rethrows -> SubSequence { var start = startIndex while try start != endIndex && predicate(self.start) { formIndex(after: &start) } return self.start..<endIndex } |
| 14 |
@inlinable public func flatMap<SegmentOfResult>( _ transform: @escaping (Elements.Element) -> SegmentOfResult ) -> LazySequence< FlattenSequence<LazyMapSequence<Elements, SegmentOfResult>>> { return self.map(transform).joined() } |
| 15 |
@inlinable public func compactMap<ElementOfResult>( _ transform: @escaping (Elements.Element) -> ElementOfResult? ) -> LazyMapSequence< LazyFilterSequence< LazyMapSequence<Elements, ElementOfResult?>>, ElementOfResult > { return self.map(transform).filter { $0 != nil }.map { $0! } } |
| 16 |
internal func _abstract( methodName: StaticString = #function, file: StaticString = #file, line: UInt = #line ) -> Never { #if INTERNAL_CHECKS_ENABLED _fatalErrorMessage("abstract method", methodName, file: file, line: line, flags: _fatalErrorFlags()) #else _conditionallyUnreachable() #endif } |
| 17 |
@_effects(releasenone) final public func hash(into hasher: inout Hasher) { ObjectIdentifier(type(of: self)).hash(into: &hasher) return withBuffer { var buffer = $0 if buffer.data.isEmpty { return } while true { let (component, type) = buffer.next() hasher.combine(component.value) if let type = type { hasher.combine(unsafeBitCast(type, to: Int.self)) } else { break } } } } |
| 18 |
internal static func _create( capacityInBytes bytes: Int, initializedBy body: (UnsafeMutableRawBufferPointer) -> Void ) -> Self { _internalInvariant(bytes > 0 && bytes % 4 == 0, "capacity must be multiple of 4 bytes") let result = Builtin.allocWithTailElems_1(self, (bytes*4)._builtinWordValue, Int32.self) result._kvcKeyPathStringPtr = nil let base = UnsafeMutableRawPointer(Builtin.projectTailElems(result, Int32.self)) body(UnsafeMutableRawBufferPointer(start: base, count: bytes)) return result } |
| 19 |
@usableFromInline internal var _storedInlineOffset: Int? { return withBuffer { var buffer = $0 if buffer.data.isEmpty { return 0 } var offset = 0 while true { let (rawComponent, optNextType) = buffer.next() switch rawComponent.header.kind { case .struct: offset += rawComponent._structOrClassOffset case .class, .computed, .optionalChain, .optionalForce, .optionalWrap, .external: return .none } if optNextType == nil { return .some(offset) } } } } } |
| 20 |
internal static func appendedType<AppendedValue>( with t: KeyPath<Value, AppendedValue>.Type ) -> KeyPath<Root, AppendedValue>.Type { let resultKind: Kind switch (self.kind, t.kind) { case (_, .reference): resultKind = .reference case (let x, .value): resultKind = x default: resultKind = .readOnly } switch resultKind { case .readOnly: return KeyPath<Root, AppendedValue>.self case .value: return WritableKeyPath.self case .reference: return ReferenceWritableKeyPath.self } } |
Комментарии