@@ -450,24 +450,31 @@ extension _CocoaDictionary: _DictionaryBuffer {
450
450
@usableFromInline
451
451
internal typealias Value = AnyObject
452
452
453
- @inlinable
453
+ @usableFromInline // FIXME(cocoa-index): Should be inlinable
454
454
internal var startIndex : Index {
455
- return Index ( self , startIndex: ( ) )
455
+ @_effects ( releasenone)
456
+ get {
457
+ return Index ( self , startIndex: ( ) )
458
+ }
456
459
}
457
460
458
- @inlinable
461
+ @usableFromInline // FIXME(cocoa-index): Should be inlinable
459
462
internal var endIndex : Index {
460
- return Index ( self , endIndex: ( ) )
463
+ @_effects ( releasenone)
464
+ get {
465
+ return Index ( self , endIndex: ( ) )
466
+ }
461
467
}
462
468
463
- @inlinable
469
+ @usableFromInline // FIXME(cocoa-index): Should be inlinable
470
+ @_effects ( releasenone)
464
471
internal func index( after i: Index ) -> Index {
465
472
var i = i
466
473
formIndex ( after: & i)
467
474
return i
468
475
}
469
476
470
- @usableFromInline
477
+ @usableFromInline // FIXME(cocoa-index): Should be inlinable
471
478
@_effects ( releasenone)
472
479
internal func formIndex( after i: inout Index ) {
473
480
_precondition ( i. base. object === self . object, " Invalid index " )
@@ -476,7 +483,8 @@ extension _CocoaDictionary: _DictionaryBuffer {
476
483
i. currentKeyIndex += 1
477
484
}
478
485
479
- @usableFromInline
486
+ @usableFromInline // FIXME(cocoa-index): Should be inlinable
487
+ @_effects ( releasenone)
480
488
internal func index( forKey key: Key ) -> Index ? {
481
489
// Fast path that does not involve creating an array of all keys. In case
482
490
// the key is present, this lookup is a penalty for the slow path, but the
@@ -516,24 +524,24 @@ extension _CocoaDictionary: _DictionaryBuffer {
516
524
return object. object ( forKey: key)
517
525
}
518
526
519
- @inlinable
520
- @inline ( __always )
527
+ @usableFromInline // FIXME(cocoa-index): Should be inlinable
528
+ @_effects ( releasenone )
521
529
internal func lookup( _ index: Index ) -> ( key: Key , value: Value ) {
522
530
_precondition ( index. base. object === self . object, " Invalid index " )
523
531
let key : Key = index. allKeys [ index. currentKeyIndex]
524
532
let value : Value = index. base. object. object ( forKey: key) !
525
533
return ( key, value)
526
534
}
527
535
528
- @inlinable
529
- @inline ( __always )
536
+ @usableFromInline // FIXME(cocoa-index): Make inlinable
537
+ @_effects ( releasenone )
530
538
func key( at index: Index ) -> Key {
531
539
_precondition ( index. base. object === self . object, " Invalid index " )
532
540
return index. key
533
541
}
534
542
535
- @inlinable
536
- @inline ( __always )
543
+ @usableFromInline // FIXME(cocoa-index): Make inlinable
544
+ @_effects ( releasenone )
537
545
func value( at index: Index ) -> Value {
538
546
_precondition ( index. base. object === self . object, " Invalid index " )
539
547
let key = index. allKeys [ index. currentKeyIndex]
@@ -557,7 +565,7 @@ extension _CocoaDictionary {
557
565
}
558
566
559
567
extension _CocoaDictionary {
560
- @ _fixed_layout // FIXME(sil-serialize-all)
568
+ // FIXME(cocoa-index): Overhaul and make @_fixed_layout
561
569
@usableFromInline
562
570
internal struct Index {
563
571
// Assumption: we rely on NSDictionary.getObjects when being
@@ -567,35 +575,29 @@ extension _CocoaDictionary {
567
575
568
576
/// A reference to the NSDictionary, which owns members in `allObjects`,
569
577
/// or `allKeys`, for NSSet and NSDictionary respectively.
570
- @usableFromInline // FIXME(sil-serialize-all)
571
578
internal let base : _CocoaDictionary
572
579
// FIXME: swift-3-indexing-model: try to remove the cocoa reference, but
573
580
// make sure that we have a safety check for accessing `allKeys`. Maybe
574
581
// move both into the dictionary/set itself.
575
582
576
583
/// An unowned array of keys.
577
- @usableFromInline // FIXME(sil-serialize-all)
578
584
internal var allKeys : _HeapBuffer < Int , AnyObject >
579
585
580
586
/// Index into `allKeys`
581
- @usableFromInline // FIXME(sil-serialize-all)
582
587
internal var currentKeyIndex : Int
583
588
584
- @inlinable // FIXME(sil-serialize-all)
585
589
internal init ( _ base: __owned _CocoaDictionary, startIndex: ( ) ) {
586
590
self . base = base
587
591
self . allKeys = _stdlib_NSDictionary_allKeys ( base. object)
588
592
self . currentKeyIndex = 0
589
593
}
590
594
591
- @inlinable // FIXME(sil-serialize-all)
592
595
internal init ( _ base: __owned _CocoaDictionary, endIndex: ( ) ) {
593
596
self . base = base
594
597
self . allKeys = _stdlib_NSDictionary_allKeys ( base. object)
595
598
self . currentKeyIndex = allKeys. value
596
599
}
597
600
598
- @inlinable // FIXME(sil-serialize-all)
599
601
internal init (
600
602
_ base: __owned _CocoaDictionary,
601
603
_ allKeys: __owned _HeapBuffer< Int , AnyObject > ,
@@ -628,7 +630,8 @@ extension _CocoaDictionary.Index {
628
630
}
629
631
630
632
extension _CocoaDictionary . Index : Equatable {
631
- @inlinable
633
+ @usableFromInline // FIXME(cocoa-index): Make inlinable
634
+ @_effects ( readonly)
632
635
internal static func == (
633
636
lhs: _CocoaDictionary . Index ,
634
637
rhs: _CocoaDictionary . Index
@@ -640,7 +643,8 @@ extension _CocoaDictionary.Index: Equatable {
640
643
}
641
644
642
645
extension _CocoaDictionary . Index : Comparable {
643
- @inlinable
646
+ @usableFromInline // FIXME(cocoa-index): Make inlinable
647
+ @_effects ( readonly)
644
648
internal static func < (
645
649
lhs: _CocoaDictionary . Index ,
646
650
rhs: _CocoaDictionary . Index
0 commit comments