- Use modern Objective-C syntax.

-  Simplify comparisons.
-  Remove dead stores.
This commit is contained in:
Eric Jensen
2016-03-15 22:34:29 -07:00
parent f97a509541
commit 33fda7ab49
25 changed files with 55 additions and 74 deletions

View File

@@ -271,8 +271,8 @@
- (void)setTitle:(NSString *)title withFont:(UIFont *)font withColor:(UIColor *)color forState:(ASControlState)state
{
NSDictionary *attributes = @{
NSFontAttributeName: font ? font :[UIFont systemFontOfSize:[UIFont buttonFontSize]],
NSForegroundColorAttributeName : color ? color : [UIColor blackColor]
NSFontAttributeName: font ?: [UIFont systemFontOfSize:[UIFont buttonFontSize]],
NSForegroundColorAttributeName : color ?: [UIColor blackColor]
};
NSAttributedString *string = [[NSAttributedString alloc] initWithString:title

View File

@@ -257,13 +257,13 @@ static BOOL _enableHitTestDebug = NO;
{
// Do we already have an event table for this control event?
id<NSCopying> eventKey = _ASControlNodeEventKeyForControlEvent(controlEvent);
NSMapTable *eventDispatchTable = [_controlEventDispatchTable objectForKey:eventKey];
NSMapTable *eventDispatchTable = _controlEventDispatchTable[eventKey];
// Create it if necessary.
if (!eventDispatchTable)
{
// Create the dispatch table for this event.
eventDispatchTable = [NSMapTable weakToStrongObjectsMapTable];
[_controlEventDispatchTable setObject:eventDispatchTable forKey:eventKey];
_controlEventDispatchTable[eventKey] = eventDispatchTable;
}
// Have we seen this target before for this event?
@@ -291,7 +291,7 @@ static BOOL _enableHitTestDebug = NO;
ASDN::MutexLocker l(_controlLock);
// Grab the event dispatch table for this event.
NSMapTable *eventDispatchTable = [_controlEventDispatchTable objectForKey:_ASControlNodeEventKeyForControlEvent(controlEvent)];
NSMapTable *eventDispatchTable = _controlEventDispatchTable[_ASControlNodeEventKeyForControlEvent(controlEvent)];
if (!eventDispatchTable)
return nil;
@@ -328,7 +328,7 @@ static BOOL _enableHitTestDebug = NO;
{
// Grab the dispatch table for this event (if we have it).
id<NSCopying> eventKey = _ASControlNodeEventKeyForControlEvent(controlEvent);
NSMapTable *eventDispatchTable = [_controlEventDispatchTable objectForKey:eventKey];
NSMapTable *eventDispatchTable = _controlEventDispatchTable[eventKey];
if (!eventDispatchTable)
return;
@@ -381,7 +381,7 @@ static BOOL _enableHitTestDebug = NO;
(ASControlNodeEvent controlEvent)
{
// Use a copy to itereate, the action perform could call remove causing a mutation crash.
NSMapTable *eventDispatchTable = [[_controlEventDispatchTable objectForKey:_ASControlNodeEventKeyForControlEvent(controlEvent)] copy];
NSMapTable *eventDispatchTable = [_controlEventDispatchTable[_ASControlNodeEventKeyForControlEvent(controlEvent)] copy];
// For each target interested in this event...
for (id target in eventDispatchTable)
@@ -413,7 +413,7 @@ static BOOL _enableHitTestDebug = NO;
id<NSCopying> _ASControlNodeEventKeyForControlEvent(ASControlNodeEvent controlEvent)
{
return [NSNumber numberWithInteger:controlEvent];
return @(controlEvent);
}
void _ASEnumerateControlEventsIncludedInMaskWithBlock(ASControlNodeEvent mask, void (^block)(ASControlNodeEvent anEvent))

View File

@@ -177,7 +177,7 @@ NS_ASSUME_NONNULL_BEGIN
* @warning The first access to it must be on the main thread, and should only be used on the main thread thereafter as
* well.
*/
@property (nonatomic, readonly, retain) UIView *view;
@property (nonatomic, readonly, strong) UIView *view;
/**
* @abstract Returns whether a node's backing view or layer is loaded.
@@ -202,7 +202,7 @@ NS_ASSUME_NONNULL_BEGIN
* @warning The first access to it must be on the main thread, and should only be used on the main thread thereafter as
* well.
*/
@property (nonatomic, readonly, retain) CALayer * _Nonnull layer;
@property (nonatomic, readonly, strong) CALayer * _Nonnull layer;
/**
* @abstract Returns the Interface State of the node.
@@ -351,7 +351,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* @abstract The receiver's immediate subnodes.
*/
@property (nonatomic, readonly, retain) NSArray<ASDisplayNode *> *subnodes;
@property (nonatomic, readonly, strong) NSArray<ASDisplayNode *> *subnodes;
/**
* @abstract The receiver's supernode.
@@ -617,7 +617,7 @@ NS_ASSUME_NONNULL_END
*/
- (void)setNeedsLayout;
@property (atomic, retain, nullable) id contents; // default=nil
@property (atomic, strong, nullable) id contents; // default=nil
@property (atomic, assign) BOOL clipsToBounds; // default==NO
@property (atomic, getter=isOpaque) BOOL opaque; // default==YES
@@ -645,9 +645,9 @@ NS_ASSUME_NONNULL_END
* @discussion In contrast to UIView, setting a transparent color will not set opaque = NO.
* This only affects nodes that implement +drawRect like ASTextNode.
*/
@property (atomic, retain, nullable) UIColor *backgroundColor; // default=nil
@property (atomic, strong, nullable) UIColor *backgroundColor; // default=nil
@property (atomic, retain, null_resettable) UIColor *tintColor; // default=Blue
@property (atomic, strong, null_resettable) UIColor *tintColor; // default=Blue
- (void)tintColorDidChange; // Notifies the node when the tintColor has changed.
/**
@@ -697,7 +697,7 @@ NS_ASSUME_NONNULL_END
@property (nullable, atomic, copy) NSString *accessibilityValue;
@property (atomic, assign) UIAccessibilityTraits accessibilityTraits;
@property (atomic, assign) CGRect accessibilityFrame;
@property (nullable, atomic, retain) NSString *accessibilityLanguage;
@property (nullable, atomic, strong) NSString *accessibilityLanguage;
@property (atomic, assign) BOOL accessibilityElementsHidden;
@property (atomic, assign) BOOL accessibilityViewIsModal;
@property (atomic, assign) BOOL shouldGroupAccessibilityChildren;

View File

@@ -224,7 +224,7 @@ static ASDisplayNodeMethodOverrides GetASDisplayNodeMethodOverrides(Class c)
if (isQueueDrained) {
[[NSNotificationCenter defaultCenter] postNotificationName:ASRenderingEngineDidDisplayScheduledNodesNotification
object:nil
userInfo:@{ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp: [NSNumber numberWithDouble:timestamp]}];
userInfo:@{ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp: @(timestamp)}];
}
}];
});
@@ -1061,7 +1061,7 @@ static inline CATransform3D _calculateTransformFromReferenceToTarget(ASDisplayNo
{
ASDisplayNodeAssertThreadAffinity(self);
// Get root node of the accessible node hierarchy, if node not specified
node = node ? node : ASDisplayNodeUltimateParentOfNode(self);
node = node ?: ASDisplayNodeUltimateParentOfNode(self);
// Calculate transform to map points between coordinate spaces
CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(node, self);
@@ -1076,7 +1076,7 @@ static inline CATransform3D _calculateTransformFromReferenceToTarget(ASDisplayNo
{
ASDisplayNodeAssertThreadAffinity(self);
// Get root node of the accessible node hierarchy, if node not specified
node = node ? node : ASDisplayNodeUltimateParentOfNode(self);
node = node ?: ASDisplayNodeUltimateParentOfNode(self);
// Calculate transform to map points between coordinate spaces
CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(self, node);
@@ -1091,7 +1091,7 @@ static inline CATransform3D _calculateTransformFromReferenceToTarget(ASDisplayNo
{
ASDisplayNodeAssertThreadAffinity(self);
// Get root node of the accessible node hierarchy, if node not specified
node = node ? node : ASDisplayNodeUltimateParentOfNode(self);
node = node ?: ASDisplayNodeUltimateParentOfNode(self);
// Calculate transform to map points between coordinate spaces
CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(node, self);
@@ -1106,7 +1106,7 @@ static inline CATransform3D _calculateTransformFromReferenceToTarget(ASDisplayNo
{
ASDisplayNodeAssertThreadAffinity(self);
// Get root node of the accessible node hierarchy, if node not specified
node = node ? node : ASDisplayNodeUltimateParentOfNode(self);
node = node ?: ASDisplayNodeUltimateParentOfNode(self);
// Calculate transform to map points between coordinate spaces
CATransform3D nodeTransform = _calculateTransformFromReferenceToTarget(self, node);
@@ -2085,11 +2085,7 @@ void recursivelyTriggerDisplayForLayer(CALayer *layer, BOOL shouldBlock)
BOOL wasVisible = ASInterfaceStateIncludesVisible(oldState);
if (nowVisible != wasVisible) {
if (nowVisible) {
[self visibilityDidChange:YES];
} else {
[self visibilityDidChange:NO];
}
[self visibilityDidChange:nowVisible];
}
[self interfaceStateDidChange:newState fromState:oldState];
@@ -2513,7 +2509,7 @@ static const char *ASDisplayNodeDrawingPriorityKey = "ASDrawingPriority";
objc_setAssociatedObject(self, ASDisplayNodeDrawingPriorityKey, nil, OBJC_ASSOCIATION_ASSIGN);
} else {
_flags.hasCustomDrawingPriority = YES;
objc_setAssociatedObject(self, ASDisplayNodeDrawingPriorityKey, [NSNumber numberWithInteger:drawingPriority], OBJC_ASSOCIATION_RETAIN);
objc_setAssociatedObject(self, ASDisplayNodeDrawingPriorityKey, @(drawingPriority), OBJC_ASSOCIATION_RETAIN);
}
}

View File

@@ -10,11 +10,6 @@
#import "ASEqualityHashHelpers.h"
#import <functional>
#import <objc/runtime.h>
#import <stdio.h>
#import <string>
NSUInteger ASIntegerArrayHash(const NSUInteger *subhashes, NSUInteger count)
{
uint64_t result = subhashes[0];

View File

@@ -33,7 +33,7 @@ typedef UIImage * _Nullable (^asimagenode_modification_block_t)(UIImage *image);
* the layer's contentsCenter property. Non-stretchable images work too, of
* course.
*/
@property (nullable, atomic, retain) UIImage *image;
@property (nullable, atomic, strong) UIImage *image;
/**
@abstract The placeholder color.

View File

@@ -28,7 +28,7 @@
@property (nonatomic, assign) BOOL opaque;
@property (nonatomic, assign) CGRect bounds;
@property (nonatomic, assign) CGFloat contentsScale;
@property (nonatomic, retain) UIColor *backgroundColor;
@property (nonatomic, strong) UIColor *backgroundColor;
@property (nonatomic, assign) UIViewContentMode contentMode;
@end

View File

@@ -53,7 +53,6 @@
{
std::deque<id> itemsToProcess = std::deque<id>();
BOOL isQueueDrained = NO;
CFAbsoluteTime timestamp = 0;
{
ASDN::MutexLocker l(_internalQueueLock);
@@ -72,7 +71,6 @@
if (_internalQueue.empty()) {
isQueueDrained = YES;
timestamp = CFAbsoluteTimeGetCurrent();
}
}

View File

@@ -118,13 +118,13 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell";
}
@property (atomic, assign) BOOL asyncDataSourceLocked;
@property (nonatomic, retain, readwrite) ASDataController *dataController;
@property (nonatomic, strong, readwrite) ASDataController *dataController;
// Used only when ASTableView is created directly rather than through ASTableNode.
// We create a node so that logic related to appearance, memory management, etc can be located there
// for both the node-based and view-based version of the table.
// This also permits sharing logic with ASCollectionNode, as the superclass is not UIKit-controlled.
@property (nonatomic, retain) ASTableNode *strongTableNode;
@property (nonatomic, strong) ASTableNode *strongTableNode;
// Always set, whether ASCollectionView is created directly or via ASCollectionNode.
@property (nonatomic, weak) ASTableNode *tableNode;

View File

@@ -12,7 +12,7 @@
@interface ASTableView (Internal)
@property (nonatomic, retain, readonly) ASDataController *dataController;
@property (nonatomic, strong, readonly) ASDataController *dataController;
@property (nonatomic, weak, readwrite) ASTableNode *tableNode;
@property (nonatomic, strong, readonly) ASRangeController *rangeController;

View File

@@ -475,7 +475,6 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
// Final output vars
__block id linkAttributeValue = nil;
__block NSString *linkAttributeName = nil;
__block BOOL inTruncationMessage = NO;
[renderer enumerateTextIndexesAtPosition:point usingBlock:^(NSUInteger characterIndex, CGRect glyphBoundingRect, BOOL *stop) {
@@ -544,7 +543,6 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
// Set the values for the next iteration
linkAttributeValue = value;
linkAttributeName = name;
break;
}

View File

@@ -80,14 +80,14 @@
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([[change objectForKey:@"new"] integerValue] == AVPlayerItemStatusReadyToPlay) {
if ([change[@"new"] integerValue] == AVPlayerItemStatusReadyToPlay) {
if ([self.subnodes containsObject:_spinner]) {
[_spinner removeFromSupernode];
_spinner = nil;
}
}
if ([[change objectForKey:@"new"] integerValue] == AVPlayerItemStatusFailed) {
if ([change[@"new"] integerValue] == AVPlayerItemStatusFailed) {
}
}

View File

@@ -104,11 +104,7 @@
- (BOOL)layoutHasSupplementaryViewOfKind:(NSString *)kind inSection:(NSUInteger)section collectionView:(ASCollectionView *)collectionView
{
CGSize size = [self sizeForSupplementaryViewOfKind:kind inSection:section collectionView:collectionView];
if ([self usedLayoutValueForSize:size] > 0) {
return YES;
} else {
return NO;
}
return [self usedLayoutValueForSize:size] > 0;
}
- (CGFloat)usedLayoutValueForSize:(CGSize)size

View File

@@ -876,12 +876,12 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
[_editingTransactionQueue addOperationWithBlock:^{
LOG(@"Edit Transaction - moveRow: %@ > %@", indexPath, newIndexPath);
NSArray *nodes = ASFindElementsInMultidimensionalArrayAtIndexPaths(_editingNodes[ASDataControllerRowNodeKind], [NSArray arrayWithObject:indexPath]);
NSArray *indexPaths = [NSArray arrayWithObject:indexPath];
NSArray *nodes = ASFindElementsInMultidimensionalArrayAtIndexPaths(_editingNodes[ASDataControllerRowNodeKind], @[indexPath]);
NSArray *indexPaths = @[indexPath];
[self _deleteNodesAtIndexPaths:indexPaths withAnimationOptions:animationOptions];
// Don't re-calculate size for moving
NSArray *newIndexPaths = [NSArray arrayWithObject:newIndexPath];
NSArray *newIndexPaths = @[newIndexPath];
[self _insertNodes:nodes atIndexPaths:newIndexPaths withAnimationOptions:animationOptions];
}];
}];
@@ -967,7 +967,7 @@ static void *kASSizingQueueContext = &kASSizingQueueContext;
- (NSArray *)completedNodes
{
ASDisplayNodeAssertMainThread();
return _externalCompletedNodes != nil ? _externalCompletedNodes : _completedNodes[ASDataControllerRowNodeKind];
return _externalCompletedNodes ?: _completedNodes[ASDataControllerRowNodeKind];
}
#pragma mark - Dealloc

View File

@@ -45,7 +45,7 @@
ASDN::MutexLocker l(_serialQueueLock);
dispatch_block_t block;
if (_blocks.count > 0) {
block = [_blocks objectAtIndex:0];
block = _blocks[0];
[_blocks removeObjectAtIndex:0];
} else {
break;

View File

@@ -286,13 +286,13 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
if (section != currentSectionIndex) {
// Often we'll be dealing with indexPaths in the same section, but the set isn't sorted and we may even bounce
// between the same ones. Still, this saves dozens of method calls to access the inner array and count.
currentSectionNodes = [allNodes objectAtIndex:section];
currentSectionNodes = allNodes[section];
numberOfNodesInSection = [currentSectionNodes count];
currentSectionIndex = section;
}
if (row < numberOfNodesInSection) {
ASDisplayNode *node = [currentSectionNodes objectAtIndex:row];
ASDisplayNode *node = currentSectionNodes[row];
ASDisplayNodeAssert(node.hierarchyState & ASHierarchyStateRangeManaged, @"All nodes reaching this point should be range-managed, or interfaceState may be incorrectly reset.");
// Skip the many method calls of the recursive operation if the top level cell node already has the right interfaceState.
@@ -345,7 +345,7 @@ static UIApplicationState __ApplicationState = UIApplicationStateActive;
- (void)scheduledNodesDidDisplay:(NSNotification *)notification
{
CFAbsoluteTime notificationTimestamp = ((NSNumber *)[notification.userInfo objectForKey:ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp]).doubleValue;
CFAbsoluteTime notificationTimestamp = ((NSNumber *) notification.userInfo[ASRenderingEngineDidDisplayNodesScheduledBeforeTimestamp]).doubleValue;
if (_pendingDisplayNodesTimestamp < notificationTimestamp) {
// The rendering engine has processed all the nodes this range controller scheduled. Let's schedule a range update
[[NSNotificationCenter defaultCenter] removeObserver:self name:ASRenderingEngineDidDisplayScheduledNodesNotification object:nil];

View File

@@ -18,7 +18,7 @@ NSInteger const ASDefaultTransactionPriority = 0;
@interface ASDisplayNodeAsyncTransactionOperation : NSObject
- (id)initWithOperationCompletionBlock:(asyncdisplaykit_async_transaction_operation_completion_block_t)operationCompletionBlock;
@property (nonatomic, copy) asyncdisplaykit_async_transaction_operation_completion_block_t operationCompletionBlock;
@property (atomic, retain) id<NSObject> value; // set on bg queue by the operation block
@property (atomic, strong) id<NSObject> value; // set on bg queue by the operation block
@end
@implementation ASDisplayNodeAsyncTransactionOperation
@@ -236,7 +236,7 @@ void ASAsyncTransactionQueue::GroupImpl::schedule(NSInteger priority, dispatch_q
operation._block();
}
operation._group->leave();
operation._block = 0; // the block must be freed while mutex is unlocked
operation._block = nil; // the block must be freed while mutex is unlocked
}
}
--entry._threadCount;

View File

@@ -10,8 +10,8 @@
@interface CALayer (ASAsyncTransactionContainerTransactions)
@property (nonatomic, retain, setter=asyncdisplaykit_setAsyncLayerTransactions:) NSHashTable *asyncdisplaykit_asyncLayerTransactions;
@property (nonatomic, retain, setter=asyncdisplaykit_setCurrentAsyncLayerTransaction:) _ASAsyncTransaction *asyncdisplaykit_currentAsyncLayerTransaction;
@property (nonatomic, strong, setter=asyncdisplaykit_setAsyncLayerTransactions:) NSHashTable *asyncdisplaykit_asyncLayerTransactions;
@property (nonatomic, strong, setter=asyncdisplaykit_setCurrentAsyncLayerTransaction:) _ASAsyncTransaction *asyncdisplaykit_currentAsyncLayerTransaction;
- (void)asyncdisplaykit_asyncTransactionContainerWillBeginTransaction:(_ASAsyncTransaction *)transaction;
- (void)asyncdisplaykit_asyncTransactionContainerDidCompleteTransaction:(_ASAsyncTransaction *)transaction;

View File

@@ -59,13 +59,13 @@ typedef NS_ENUM(NSUInteger, ASAsyncTransactionContainerState) {
did not already exist. This method will always return an open, uncommitted transaction.
@desc asyncdisplaykit_isAsyncTransactionContainer does not need to be YES for this to return a transaction.
*/
@property (nonatomic, readonly, retain) _ASAsyncTransaction *asyncdisplaykit_asyncTransaction;
@property (nonatomic, readonly, strong) _ASAsyncTransaction *asyncdisplaykit_asyncTransaction;
/**
@summary Goes up the superlayer chain until it finds the first layer with asyncdisplaykit_isAsyncTransactionContainer=YES (including the receiver) and returns it.
Returns nil if no parent container is found.
*/
@property (nonatomic, readonly, retain) CALayer *asyncdisplaykit_parentTransactionContainer;
@property (nonatomic, readonly, strong) CALayer *asyncdisplaykit_parentTransactionContainer;
@end
@interface UIView (ASDisplayNodeAsyncTransactionContainer) <ASDisplayNodeAsyncTransactionContainer>

View File

@@ -20,20 +20,20 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) CGPoint position;
@property (nonatomic, assign) CGFloat zPosition;
@property (nonatomic, assign) CGPoint anchorPoint;
@property (nullable, nonatomic, retain) id contents;
@property (nullable, nonatomic, strong) id contents;
@property (nonatomic, assign) CGFloat cornerRadius;
@property (nonatomic, assign) CGFloat contentsScale;
@property (nonatomic, assign) CATransform3D transform;
@property (nonatomic, assign) CATransform3D sublayerTransform;
@property (nonatomic, assign) BOOL needsDisplayOnBoundsChange;
@property (nonatomic, retain) __attribute__((NSObject)) CGColorRef shadowColor;
@property (nonatomic, strong) __attribute__((NSObject)) CGColorRef shadowColor;
@property (nonatomic, assign) CGFloat shadowOpacity;
@property (nonatomic, assign) CGSize shadowOffset;
@property (nonatomic, assign) CGFloat shadowRadius;
@property (nonatomic, assign) CGFloat borderWidth;
@property (nonatomic, assign, getter = isOpaque) BOOL opaque;
@property (nonatomic, retain) __attribute__((NSObject)) CGColorRef borderColor;
@property (nonatomic, retain) __attribute__((NSObject)) CGColorRef backgroundColor;
@property (nonatomic, strong) __attribute__((NSObject)) CGColorRef borderColor;
@property (nonatomic, strong) __attribute__((NSObject)) CGColorRef backgroundColor;
@property (nonatomic, assign) BOOL allowsEdgeAntialiasing;
@property (nonatomic, assign) unsigned int edgeAntialiasingMask;
@@ -51,7 +51,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, getter=isHidden) BOOL hidden;
@property (nonatomic, assign) BOOL autoresizesSubviews;
@property (nonatomic, assign) UIViewAutoresizing autoresizingMask;
@property (nonatomic, retain, null_resettable) UIColor *tintColor;
@property (nonatomic, strong, null_resettable) UIColor *tintColor;
@property (nonatomic, assign) CGFloat alpha;
@property (nonatomic, assign) CGRect bounds;
@property (nonatomic, assign) CGRect frame; // Only for use with nodes wrapping synchronous views
@@ -71,7 +71,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (atomic, copy) NSString *accessibilityValue;
@property (atomic, assign) UIAccessibilityTraits accessibilityTraits;
@property (atomic, assign) CGRect accessibilityFrame;
@property (atomic, retain) NSString *accessibilityLanguage;
@property (atomic, strong) NSString *accessibilityLanguage;
@property (atomic, assign) BOOL accessibilityElementsHidden;
@property (atomic, assign) BOOL accessibilityViewIsModal;
@property (atomic, assign) BOOL shouldGroupAccessibilityChildren;

View File

@@ -23,7 +23,7 @@
// Keep the node alive while its view is active. If you create a view, add its layer to a layer hierarchy, then release
// the view, the layer retains the view to prevent a crash. This replicates this behaviour for the node abstraction.
@property (nonatomic, retain, readwrite) ASDisplayNode *keepalive_node;
@property (nonatomic, strong, readwrite) ASDisplayNode *keepalive_node;
@end
@implementation _ASDisplayView

View File

@@ -100,7 +100,7 @@ struct _Range {
{
CGFloat newMin = MAX(min, other.min);
CGFloat newMax = MIN(max, other.max);
if (!(newMin > newMax)) {
if (newMin <= newMax) {
return {newMin, newMax};
} else {
// No intersection. If we're before the other range, return our max; otherwise our min.

View File

@@ -139,7 +139,7 @@ FOUNDATION_EXPORT NSString * const ASRenderingEngineDidDisplayNodesScheduledBefo
+ (void)scheduleNodeForRecursiveDisplay:(ASDisplayNode *)node;
// The _ASDisplayLayer backing the node, if any.
@property (nonatomic, readonly, retain) _ASDisplayLayer *asyncLayer;
@property (nonatomic, readonly, strong) _ASDisplayLayer *asyncLayer;
// Bitmask to check which methods an object overrides.
@property (nonatomic, assign, readonly) ASDisplayNodeMethodOverrides methodOverrides;

View File

@@ -24,7 +24,7 @@ extern NSString *const ASTextKitEntityAttributeName;
static inline BOOL _objectsEqual(id<NSObject> obj1, id<NSObject> obj2)
{
return obj1 == obj2 ? YES : [obj1 isEqual:obj2];
return obj1 == obj2 || [obj1 isEqual:obj2];
}
/**

View File

@@ -16,7 +16,5 @@
*/
ASDISPLAYNODE_INLINE BOOL ASObjectIsEqual(id<NSObject> obj, id<NSObject> otherObj)
{
if (obj == otherObj)
return YES;
return [obj isEqual:otherObj];
return obj == otherObj || [obj isEqual:otherObj];
}