From 1b72646772a88c84a63c38a1500b3ef7356a6d18 Mon Sep 17 00:00:00 2001 From: cacaodev Date: Sun, 17 Jan 2016 20:54:20 +0100 Subject: [PATCH 1/5] Style: remove tabs --- Foundation/CPArray/_CPArray.j | 18 +++++++++--------- Foundation/CPArray/_CPJavaScriptArray.j | 14 +++++++------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Foundation/CPArray/_CPArray.j b/Foundation/CPArray/_CPArray.j index 7607aa480..9a18fc879 100755 --- a/Foundation/CPArray/_CPArray.j +++ b/Foundation/CPArray/_CPArray.j @@ -881,22 +881,22 @@ Returns a hash for the object. Unlike Cocoa, the hash value does not take conten } /*! - Returns an Array formed by applying a function to the objects in the receiver. + Returns an Array formed by applying a function to each object in the receiver. @param aFunction a function taking two arguments: (element, index). @return an Array containing the transformed elements. */ - (CPArray)arrayByApplyingBlock:(Function/*element, index*/)aFunction { - var result = [], - count = [self count]; + var result = [], + count = [self count]; - for (var idx = 0; idx < count; idx++) - { - var obj = aFunction([self objectAtIndex:idx], idx); - [result addObject:obj]; - } + for (var idx = 0; idx < count; idx++) + { + var obj = aFunction([self objectAtIndex:idx], idx); + [result addObject:obj]; + } - return result; + return result; } // Creating a description of the array diff --git a/Foundation/CPArray/_CPJavaScriptArray.j b/Foundation/CPArray/_CPJavaScriptArray.j index 6d36a8586..8822ed0b4 100644 --- a/Foundation/CPArray/_CPJavaScriptArray.j +++ b/Foundation/CPArray/_CPJavaScriptArray.j @@ -235,15 +235,15 @@ var concat = Array.prototype.concat, - (CPArray)arrayByApplyingBlock:(Function/*element, index*/)aFunction { - var result = []; + var result = []; - for (var idx = 0; idx < self.length; idx++) - { - var obj = aFunction(self[idx], idx); - result.push(obj); - } + for (var idx = 0; idx < self.length; idx++) + { + var obj = aFunction(self[idx], idx); + result.push(obj); + } - return result; + return result; } - (void)insertObject:(id)anObject atIndex:(CPUInteger)anIndex From 095a9781202d29e61b4ecc60646a574678e75124 Mon Sep 17 00:00:00 2001 From: cacaodev Date: Sun, 17 Jan 2016 20:54:43 +0100 Subject: [PATCH 2/5] Replace loops with arrayByApplyingBlock: --- AppKit/CPColorPanel.j | 11 +++-- AppKit/CPGradient.j | 11 ++--- AppKit/CPGraphics.j | 8 ++-- AppKit/CPPopUpButton.j | 13 ++---- AppKit/CPThemeBlend.j | 10 ++--- AppKit/CPToolbar.j | 9 ++--- AppKit/Platform/DOM/CPPlatformWindow+DOM.j | 11 +++-- Foundation/CPAttributedString.j | 11 ++--- Foundation/CPBundle.j | 13 +++--- Foundation/CPIndexSet.j | 11 +++-- Foundation/CPKeyedArchiver.j | 10 ++--- .../CPPredicate/_CPAggregateExpression.j | 40 +++++++------------ .../CPPredicate/_CPFunctionExpression.j | 9 ++--- 13 files changed, 68 insertions(+), 99 deletions(-) diff --git a/AppKit/CPColorPanel.j b/AppKit/CPColorPanel.j index d00baa311..c30c07cab 100644 --- a/AppKit/CPColorPanel.j +++ b/AppKit/CPColorPanel.j @@ -483,13 +483,12 @@ var CPColorPanelSwatchesCookie = "CPColorPanelSwatchesCookie"; ]; } - var cookieValue = eval(cookieValue), - result = []; + var cookieValue = eval(cookieValue); - for (var i = 0; i < cookieValue.length; i++) - result.push([CPColor colorWithHexString:cookieValue[i]]); - - return result; + return [cookieValue arrayByApplyingBlock:function(value, _) + { + return [CPColor colorWithHexString:value]; + }]; } - (CPArray)saveColorList diff --git a/AppKit/CPGradient.j b/AppKit/CPGradient.j index dfa7a3437..126e43995 100644 --- a/AppKit/CPGradient.j +++ b/AppKit/CPGradient.j @@ -70,11 +70,12 @@ CPGradientDrawsAfterEndingLocation = kCGGradientDrawsAfterEndLocation; { if (self = [super init]) { - var cgColors = [], - count = [someColors count], - colorSpace = [aColorSpace CGColorSpace] || CGColorSpaceCreateDeviceRGB; - for (var i = 0; i < count; i++) - cgColors.push(CGColorCreate(colorSpace, [someColors[i] components])); + var colorSpace = [aColorSpace CGColorSpace] || CGColorSpaceCreateDeviceRGB, + cgColors = [someColors arrayByApplyingBlock:function(color, _) + { + return CGColorCreate(colorSpace, [color components]) + }]; + _gradient = CGGradientCreateWithColors(colorSpace, cgColors, someLocations); } diff --git a/AppKit/CPGraphics.j b/AppKit/CPGraphics.j index 380bea393..207e05c8c 100644 --- a/AppKit/CPGraphics.j +++ b/AppKit/CPGraphics.j @@ -43,10 +43,10 @@ function CPDrawTiledRects( if (sides.length != grays.length) [CPException raise:CPInvalidArgumentException reason:@"sides (length: " + sides.length + ") and grays (length: " + grays.length + ") must have the same length."]; - var colors = []; - - for (var i = 0; i < grays.length; ++i) - colors.push([CPColor colorWithCalibratedWhite:grays[i] alpha:1.0]); + var colors = [grays arrayByApplyingBlock:function(gray, _) + { + return [CPColor colorWithCalibratedWhite:gray alpha:1.0]; + }]; return CPDrawColorTiledRects(boundsRect, clipRect, sides, colors); } diff --git a/AppKit/CPPopUpButton.j b/AppKit/CPPopUpButton.j index 09aecb6fe..77c6cda06 100644 --- a/AppKit/CPPopUpButton.j +++ b/AppKit/CPPopUpButton.j @@ -361,15 +361,10 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down"); */ - (CPArray)itemTitles { - var titles = [], - items = [self itemArray], - index = 0, - count = [items count]; - - for (; index < count; ++index) - titles.push([items[index] title]); - - return titles; + return [[self itemArray] arrayByApplyingBlock:function(item, _) + { + return [item title]; + }]; } /*! diff --git a/AppKit/CPThemeBlend.j b/AppKit/CPThemeBlend.j index 8455bd4c0..a34544841 100644 --- a/AppKit/CPThemeBlend.j +++ b/AppKit/CPThemeBlend.j @@ -64,12 +64,10 @@ */ - (CPArray)themeNames { - var names = []; - - for (var i = 0; i < _themes.length; ++i) - names.push(_themes[i].substring(0, _themes[i].indexOf(".keyedtheme"))); - - return names; + return [_themes arrayByApplyingBlock:function(theme, _) + { + return theme.substring(0, theme.indexOf(".keyedtheme")); + }]; } - (void)loadWithDelegate:(id)aDelegate diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index 49c78924e..8954c7160 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -459,11 +459,10 @@ var CPToolbarsByIdentifier = nil, /* @ignore */ - (id)_itemsWithIdentifiers:(CPArray)identifiers { - var items = []; - for (var i = 0; i < identifiers.length; i++) - [items addObject:[self _itemForItemIdentifier:identifiers[i] willBeInsertedIntoToolbar:NO]]; - - return items; + return [identifiers arrayByApplyingBlock:function(identifier, _) + { + return [self _itemForItemIdentifier:identifier willBeInsertedIntoToolbar:NO]; + }]; } /* @ignore */ diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index bb183bd99..6d24c1985 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -1857,11 +1857,10 @@ function CPWindowObjectList() function CPWindowList() { - var windowObjectList = CPWindowObjectList(), - windowList = []; + var windowObjectList = CPWindowObjectList(); - for (var i = 0, count = [windowObjectList count]; i < count; i++) - windowList.push([windowObjectList[i] windowNumber]); - - return windowList; + return [windowObjectList arrayByApplyingBlock:function(windowObject, _) + { + return [windowObject windowNumber]; + }]; } diff --git a/Foundation/CPAttributedString.j b/Foundation/CPAttributedString.j index 04c131631..7badf601e 100755 --- a/Foundation/CPAttributedString.j +++ b/Foundation/CPAttributedString.j @@ -763,13 +763,10 @@ - (void)setAttributedString:(CPAttributedString)aString { _string = aString._string; - _rangeEntries = []; - - var i = 0, - count = aString._rangeEntries.length; - - for (; i < count; i++) - _rangeEntries.push(copyRangeEntry(aString._rangeEntries[i])); + _rangeEntries = [aString._rangeEntries arrayByApplyingBlock:function(entry, _) + { + return copyRangeEntry(entry); + }]; } //Private methods diff --git a/Foundation/CPBundle.j b/Foundation/CPBundle.j index 069e0e6eb..8c3ab2918 100644 --- a/Foundation/CPBundle.j +++ b/Foundation/CPBundle.j @@ -212,15 +212,12 @@ var CPBundlesForURLStrings = { }; - (CPArray)staticResourceURLs { - var staticResourceURLs = [], - staticResources = _bundle.staticResources(), - index = 0, - count = [staticResources count]; + var staticResources = _bundle.staticResources(); - for (; index < count; ++index) - [staticResourceURLs addObject:staticResources[index].URL()]; - - return staticResourceURLs; + return [staticResources arrayByApplyingBlock:function(resource, _) + { + return resource.URL(); + }]; } - (CPArray)environments diff --git a/Foundation/CPIndexSet.j b/Foundation/CPIndexSet.j index c9f94fddb..e23f4a451 100644 --- a/Foundation/CPIndexSet.j +++ b/Foundation/CPIndexSet.j @@ -1018,14 +1018,13 @@ var CPIndexSetCountKey = @"CPIndexSetCountKey", if (self) { _count = [aCoder decodeIntForKey:CPIndexSetCountKey]; - _ranges = []; - var rangeStrings = [aCoder decodeObjectForKey:CPIndexSetRangeStringsKey], - index = 0, - count = rangeStrings.length; + var rangeStrings = [aCoder decodeObjectForKey:CPIndexSetRangeStringsKey]; - for (; index < count; ++index) - _ranges.push(CPRangeFromString(rangeStrings[index])); + _ranges = [rangeStrings arrayByApplyingBlock:function(range, _) + { + return CPRangeFromString(range); + }]; } return self; diff --git a/Foundation/CPKeyedArchiver.j b/Foundation/CPKeyedArchiver.j index e4e0d7bbd..7c074c383 100644 --- a/Foundation/CPKeyedArchiver.j +++ b/Foundation/CPKeyedArchiver.j @@ -380,12 +380,10 @@ var _CPKeyedArchiverStringClass = Nil, /* @ignore */ - (void)_encodeArrayOfObjects:(CPArray)objects forKey:(CPString)aKey { - var i = 0, - count = objects.length, - references = []; - - for (; i < count; ++i) - [references addObject:_CPKeyedArchiverEncodeObject(self, objects[i], NO)]; + var references = [objects arrayByApplyingBlock:function(object, _) + { + return _CPKeyedArchiverEncodeObject(self, object, NO); + }]; [_plistObject setObject:references forKey:aKey]; } diff --git a/Foundation/CPPredicate/_CPAggregateExpression.j b/Foundation/CPPredicate/_CPAggregateExpression.j index 688166398..d3bdfc406 100644 --- a/Foundation/CPPredicate/_CPAggregateExpression.j +++ b/Foundation/CPPredicate/_CPAggregateExpression.j @@ -34,6 +34,7 @@ if (self) _aggregate = collection; + return self; } @@ -55,41 +56,28 @@ - (id)expressionValueWithObject:(id)object context:(CPDictionary)context { - var eval_array = [CPArray array], - collection = [_aggregate objectEnumerator], - exp; - - while ((exp = [collection nextObject]) !== nil) + return [_aggregate arrayByApplyingBlock:function(exp, _) { - var eval = [exp expressionValueWithObject:object context:context]; - [eval_array addObject:eval]; - } - - return eval_array; + return [exp expressionValueWithObject:object context:context]; + }]; } - (CPString)description -{ - var i = 0, - count = [_aggregate count], - result = "{"; +{ + var descriptions = [_aggregate arrayByApplyingBlock:function(exp, _) + { + return [exp description]; + }]; - for (; i < count; i++) - result = result + [CPString stringWithFormat:@"%s%s", [[_aggregate objectAtIndex:i] description], (i + 1 < count) ? @", " : @""]; - - result = result + "}"; - - return result; + return "{" + [descriptions componentsJoinedByString:","] + "}" ; } - (CPExpression)_expressionWithSubstitutionVariables:(CPDictionary)variables { - var subst_array = [CPArray array], - count = [_aggregate count], - i = 0; - - for (; i < count; i++) - [subst_array addObject:[[_aggregate objectAtIndex:i] _expressionWithSubstitutionVariables:variables]]; + var subst_array = [_aggregate arrayByApplyingBlock:function(exp, _) + { + return [exp _expressionWithSubstitutionVariables:variables]; + }]; return [CPExpression expressionForAggregate:subst_array]; } diff --git a/Foundation/CPPredicate/_CPFunctionExpression.j b/Foundation/CPPredicate/_CPFunctionExpression.j index 394c93612..b0d854dd9 100644 --- a/Foundation/CPPredicate/_CPFunctionExpression.j +++ b/Foundation/CPPredicate/_CPFunctionExpression.j @@ -143,11 +143,10 @@ - (CPExpression)_expressionWithSubstitutionVariables:(CPDictionary)variables { var operand = [[self operand] _expressionWithSubstitutionVariables:variables], - args = [CPArray array], - i = 0; - - for (; i < _argc; i++) - [args addObject:[_arguments[i] _expressionWithSubstitutionVariables:variables]]; + args = [_arguments arrayByApplyingBlock:function(arg, _) + { + return [arg _expressionWithSubstitutionVariables:variables]; + }]; return [CPExpression expressionForFunction:operand selectorName:[self _function] arguments:args]; } From d07d8f6857d89701c4d99ac25fb006a36779b26d Mon Sep 17 00:00:00 2001 From: cacaodev Date: Thu, 4 Feb 2016 21:50:31 +0100 Subject: [PATCH 3/5] _CPBlockExpression: replace loops with arrayByApplyingBlock: method --- Foundation/CPPredicate/_CPBlockExpression.j | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Foundation/CPPredicate/_CPBlockExpression.j b/Foundation/CPPredicate/_CPBlockExpression.j index 299f250ee..6b91b3967 100644 --- a/Foundation/CPPredicate/_CPBlockExpression.j +++ b/Foundation/CPPredicate/_CPBlockExpression.j @@ -53,11 +53,9 @@ - (id)expressionValueWithObject:(id)object context:(CPDictionary)context { - var args = []; - - [_arguments enumerateObjectsUsingBlock:function(exp, idx) + var args = [_arguments arrayByApplyingBlock:function(exp, _) { - [args addObject:[exp expressionValueWithObject:object context:context]]; + return [exp expressionValueWithObject:object context:context]; }]; return _block(object, args, context); @@ -65,11 +63,9 @@ - (CPExpression)_expressionWithSubstitutionVariables:(CPDictionary)bindings { - var args = []; - - [_arguments enumerateObjectsUsingBlock:function(exp, idx) + var args = [_arguments arrayByApplyingBlock:function(exp, _) { - [args addObject:[exp _expressionWithSubstitutionVariables:bindings]]; + return [exp _expressionWithSubstitutionVariables:bindings]; }]; return [[_CPBlockExpression alloc] initWithBlock:_block arguments:args]; From 65dee154f7fa2c04ad8ae3deeeedd88f804ff625 Mon Sep 17 00:00:00 2001 From: cacaodev Date: Sat, 6 Feb 2016 20:39:49 +0100 Subject: [PATCH 4/5] Remove ignored argument _ --- AppKit/CPComboBox.j | 6 ++---- AppKit/CPGradient.j | 2 +- AppKit/CPGraphics.j | 2 +- AppKit/CPPopUpButton.j | 2 +- AppKit/CPThemeBlend.j | 2 +- AppKit/CPToolbar.j | 2 +- AppKit/Platform/DOM/CPPlatformWindow+DOM.j | 2 +- Foundation/CPAttributedString.j | 2 +- Foundation/CPBundle.j | 2 +- Foundation/CPIndexSet.j | 2 +- Foundation/CPKeyedArchiver.j | 2 +- Foundation/CPPredicate/_CPAggregateExpression.j | 6 +++--- Foundation/CPPredicate/_CPBlockExpression.j | 4 ++-- Foundation/CPPredicate/_CPFunctionExpression.j | 2 +- 14 files changed, 18 insertions(+), 20 deletions(-) diff --git a/AppKit/CPComboBox.j b/AppKit/CPComboBox.j index b5aa1b7c2..61a159ed7 100644 --- a/AppKit/CPComboBox.j +++ b/AppKit/CPComboBox.j @@ -1142,11 +1142,9 @@ var CPComboBoxTextSubview = @"text", // Directly nuke _items, [_items removeAll] will trigger an extra call to setContent _items = []; - var values = []; - - [anArray enumerateObjectsUsingBlock:function(object) + var values = [anArray arrayByApplyingBlock:function(object) { - values.push([object description]); + return [object description]; }]; [self addItemsWithObjectValues:values]; diff --git a/AppKit/CPGradient.j b/AppKit/CPGradient.j index 126e43995..93b08b2d2 100644 --- a/AppKit/CPGradient.j +++ b/AppKit/CPGradient.j @@ -71,7 +71,7 @@ CPGradientDrawsAfterEndingLocation = kCGGradientDrawsAfterEndLocation; if (self = [super init]) { var colorSpace = [aColorSpace CGColorSpace] || CGColorSpaceCreateDeviceRGB, - cgColors = [someColors arrayByApplyingBlock:function(color, _) + cgColors = [someColors arrayByApplyingBlock:function(color) { return CGColorCreate(colorSpace, [color components]) }]; diff --git a/AppKit/CPGraphics.j b/AppKit/CPGraphics.j index 207e05c8c..55dbb9f73 100644 --- a/AppKit/CPGraphics.j +++ b/AppKit/CPGraphics.j @@ -43,7 +43,7 @@ function CPDrawTiledRects( if (sides.length != grays.length) [CPException raise:CPInvalidArgumentException reason:@"sides (length: " + sides.length + ") and grays (length: " + grays.length + ") must have the same length."]; - var colors = [grays arrayByApplyingBlock:function(gray, _) + var colors = [grays arrayByApplyingBlock:function(gray) { return [CPColor colorWithCalibratedWhite:gray alpha:1.0]; }]; diff --git a/AppKit/CPPopUpButton.j b/AppKit/CPPopUpButton.j index 77c6cda06..6eecf9420 100644 --- a/AppKit/CPPopUpButton.j +++ b/AppKit/CPPopUpButton.j @@ -361,7 +361,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down"); */ - (CPArray)itemTitles { - return [[self itemArray] arrayByApplyingBlock:function(item, _) + return [[self itemArray] arrayByApplyingBlock:function(item) { return [item title]; }]; diff --git a/AppKit/CPThemeBlend.j b/AppKit/CPThemeBlend.j index a34544841..78cceaac3 100644 --- a/AppKit/CPThemeBlend.j +++ b/AppKit/CPThemeBlend.j @@ -64,7 +64,7 @@ */ - (CPArray)themeNames { - return [_themes arrayByApplyingBlock:function(theme, _) + return [_themes arrayByApplyingBlock:function(theme) { return theme.substring(0, theme.indexOf(".keyedtheme")); }]; diff --git a/AppKit/CPToolbar.j b/AppKit/CPToolbar.j index 8954c7160..b62aa82d6 100644 --- a/AppKit/CPToolbar.j +++ b/AppKit/CPToolbar.j @@ -459,7 +459,7 @@ var CPToolbarsByIdentifier = nil, /* @ignore */ - (id)_itemsWithIdentifiers:(CPArray)identifiers { - return [identifiers arrayByApplyingBlock:function(identifier, _) + return [identifiers arrayByApplyingBlock:function(identifier) { return [self _itemForItemIdentifier:identifier willBeInsertedIntoToolbar:NO]; }]; diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index 6d24c1985..fa54e8892 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -1859,7 +1859,7 @@ function CPWindowList() { var windowObjectList = CPWindowObjectList(); - return [windowObjectList arrayByApplyingBlock:function(windowObject, _) + return [windowObjectList arrayByApplyingBlock:function(windowObject) { return [windowObject windowNumber]; }]; diff --git a/Foundation/CPAttributedString.j b/Foundation/CPAttributedString.j index 7badf601e..3416b64bc 100755 --- a/Foundation/CPAttributedString.j +++ b/Foundation/CPAttributedString.j @@ -763,7 +763,7 @@ - (void)setAttributedString:(CPAttributedString)aString { _string = aString._string; - _rangeEntries = [aString._rangeEntries arrayByApplyingBlock:function(entry, _) + _rangeEntries = [aString._rangeEntries arrayByApplyingBlock:function(entry) { return copyRangeEntry(entry); }]; diff --git a/Foundation/CPBundle.j b/Foundation/CPBundle.j index 8c3ab2918..fa752574a 100644 --- a/Foundation/CPBundle.j +++ b/Foundation/CPBundle.j @@ -214,7 +214,7 @@ var CPBundlesForURLStrings = { }; { var staticResources = _bundle.staticResources(); - return [staticResources arrayByApplyingBlock:function(resource, _) + return [staticResources arrayByApplyingBlock:function(resource) { return resource.URL(); }]; diff --git a/Foundation/CPIndexSet.j b/Foundation/CPIndexSet.j index e23f4a451..1783caf27 100644 --- a/Foundation/CPIndexSet.j +++ b/Foundation/CPIndexSet.j @@ -1021,7 +1021,7 @@ var CPIndexSetCountKey = @"CPIndexSetCountKey", var rangeStrings = [aCoder decodeObjectForKey:CPIndexSetRangeStringsKey]; - _ranges = [rangeStrings arrayByApplyingBlock:function(range, _) + _ranges = [rangeStrings arrayByApplyingBlock:function(range) { return CPRangeFromString(range); }]; diff --git a/Foundation/CPKeyedArchiver.j b/Foundation/CPKeyedArchiver.j index 7c074c383..20bb7b4be 100644 --- a/Foundation/CPKeyedArchiver.j +++ b/Foundation/CPKeyedArchiver.j @@ -380,7 +380,7 @@ var _CPKeyedArchiverStringClass = Nil, /* @ignore */ - (void)_encodeArrayOfObjects:(CPArray)objects forKey:(CPString)aKey { - var references = [objects arrayByApplyingBlock:function(object, _) + var references = [objects arrayByApplyingBlock:function(object) { return _CPKeyedArchiverEncodeObject(self, object, NO); }]; diff --git a/Foundation/CPPredicate/_CPAggregateExpression.j b/Foundation/CPPredicate/_CPAggregateExpression.j index 40760c626..e141b1915 100644 --- a/Foundation/CPPredicate/_CPAggregateExpression.j +++ b/Foundation/CPPredicate/_CPAggregateExpression.j @@ -51,7 +51,7 @@ - (id)expressionValueWithObject:(id)object context:(CPDictionary)context { - return [_aggregate arrayByApplyingBlock:function(exp, _) + return [_aggregate arrayByApplyingBlock:function(exp) { return [exp expressionValueWithObject:object context:context]; }]; @@ -59,7 +59,7 @@ - (CPString)description { - var descriptions = [_aggregate arrayByApplyingBlock:function(exp, _) + var descriptions = [_aggregate arrayByApplyingBlock:function(exp) { return [exp description]; }]; @@ -69,7 +69,7 @@ - (CPExpression)_expressionWithSubstitutionVariables:(CPDictionary)variables { - var subst_array = [_aggregate arrayByApplyingBlock:function(exp, _) + var subst_array = [_aggregate arrayByApplyingBlock:function(exp) { return [exp _expressionWithSubstitutionVariables:variables]; }]; diff --git a/Foundation/CPPredicate/_CPBlockExpression.j b/Foundation/CPPredicate/_CPBlockExpression.j index 6b91b3967..846c4f418 100644 --- a/Foundation/CPPredicate/_CPBlockExpression.j +++ b/Foundation/CPPredicate/_CPBlockExpression.j @@ -53,7 +53,7 @@ - (id)expressionValueWithObject:(id)object context:(CPDictionary)context { - var args = [_arguments arrayByApplyingBlock:function(exp, _) + var args = [_arguments arrayByApplyingBlock:function(exp) { return [exp expressionValueWithObject:object context:context]; }]; @@ -63,7 +63,7 @@ - (CPExpression)_expressionWithSubstitutionVariables:(CPDictionary)bindings { - var args = [_arguments arrayByApplyingBlock:function(exp, _) + var args = [_arguments arrayByApplyingBlock:function(exp) { return [exp _expressionWithSubstitutionVariables:bindings]; }]; diff --git a/Foundation/CPPredicate/_CPFunctionExpression.j b/Foundation/CPPredicate/_CPFunctionExpression.j index 1630bc007..7de9f0d73 100644 --- a/Foundation/CPPredicate/_CPFunctionExpression.j +++ b/Foundation/CPPredicate/_CPFunctionExpression.j @@ -133,7 +133,7 @@ - (CPExpression)_expressionWithSubstitutionVariables:(CPDictionary)variables { var operand = [[self operand] _expressionWithSubstitutionVariables:variables], - args = [_arguments arrayByApplyingBlock:function(arg, _) + args = [_arguments arrayByApplyingBlock:function(arg) { return [arg _expressionWithSubstitutionVariables:variables]; }]; From d3dab982a16f369481be45f4ca45a9ee6fad1869 Mon Sep 17 00:00:00 2001 From: cacaodev Date: Sun, 7 Feb 2016 11:54:16 +0100 Subject: [PATCH 5/5] Remove ignored argument _ in CPColorPanel --- AppKit/CPColorPanel.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPColorPanel.j b/AppKit/CPColorPanel.j index c30c07cab..e8a9320eb 100644 --- a/AppKit/CPColorPanel.j +++ b/AppKit/CPColorPanel.j @@ -485,7 +485,7 @@ var CPColorPanelSwatchesCookie = "CPColorPanelSwatchesCookie"; var cookieValue = eval(cookieValue); - return [cookieValue arrayByApplyingBlock:function(value, _) + return [cookieValue arrayByApplyingBlock:function(value) { return [CPColor colorWithHexString:value]; }];