From 96a7723d3bf50f144e8ee46dfc8fc3cd7eee2b54 Mon Sep 17 00:00:00 2001 From: Garrett Moon Date: Tue, 12 Mar 2019 15:32:58 -0700 Subject: [PATCH] Context is a pretty general name that will cause conflicts with subclasses (#1399) --- Source/ASDisplayNode.h | 6 +++--- .../CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.mm | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/ASDisplayNode.h b/Source/ASDisplayNode.h index cedb7364d9..59fe93678f 100644 --- a/Source/ASDisplayNode.h +++ b/Source/ASDisplayNode.h @@ -97,11 +97,11 @@ AS_EXTERN NSInteger const ASDefaultDrawingPriority; @interface ASDisplayNode : NSObject { @public /** - * The _context ivar is unused by Texture, but provided to enable advanced clients to make powerful extensions to base class functionality. - * For example, _context can be used to implement category methods on ASDisplayNode that add functionality to all node subclass types. + * The _displayNodeContext ivar is unused by Texture, but provided to enable advanced clients to make powerful extensions to base class functionality. + * For example, _displayNodeContext can be used to implement category methods on ASDisplayNode that add functionality to all node subclass types. * Code demonstrating this technique can be found in the CatDealsCollectionView example. */ - void *_context; + void *_displayNodeContext; } /** @name Initializing a node object */ diff --git a/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.mm b/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.mm index 76d9eb2773..f7154ae5e3 100644 --- a/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.mm +++ b/examples/CatDealsCollectionView/Sample/ASDisplayNode+CatDeals.mm @@ -14,16 +14,16 @@ struct CatDealsNodeContext { NSString *loggingID = nil; }; -// Convenience to cast _context into our struct reference. +// Convenience to cast _displayNodeContext into our struct reference. NS_INLINE CatDealsNodeContext &GetNodeContext(ASDisplayNode *node) { - return *static_cast(node->_context); + return *static_cast(node->_displayNodeContext); } @implementation ASDisplayNode (CatDeals) - (void)baseDidInit { - _context = new CatDealsNodeContext; + _displayNodeContext = new CatDealsNodeContext; } - (void)baseWillDealloc