From 2fc75be3dddf0ad91b4b942bbf18991c2aa46ca0 Mon Sep 17 00:00:00 2001 From: Andrew Hankinson Date: Wed, 14 Jan 2015 17:12:16 -0500 Subject: [PATCH] Fixed: CPStepper class method returns `id` instead of CPStepper type Previously the CPStepper class returned the `CPStepper` type instead of the `id` type. This caused warnings to be raised when initializing subclasses of CPStepper. This commit fixes this issue by specifying the `id` type in the return values. Fixes #2293 --- AppKit/CPStepper.j | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/AppKit/CPStepper.j b/AppKit/CPStepper.j index 928180f62..3436d062f 100644 --- a/AppKit/CPStepper.j +++ b/AppKit/CPStepper.j @@ -25,7 +25,6 @@ @import "CPTextField.j" - /*! CPStepper is an implementation of Cocoa NSStepper. @@ -53,9 +52,9 @@ @param maxValue the maximal acceptable value of the stepper @return Initialized CPStepper */ -+ (CPStepper)stepperWithInitialValue:(float)aValue minValue:(float)aMinValue maxValue:(float)aMaxValue ++ (id)stepperWithInitialValue:(float)aValue minValue:(float)aMinValue maxValue:(float)aMaxValue { - var stepper = [[CPStepper alloc] initWithFrame:CGRectMakeZero()]; + var stepper = [[self alloc] initWithFrame:CGRectMakeZero()]; [stepper setDoubleValue:aValue]; [stepper setMinValue:aMinValue]; @@ -75,14 +74,14 @@ @return Initialized CPStepper */ -+ (CPStepper)stepper ++ (id)stepper { return [CPStepper stepperWithInitialValue:0.0 minValue:0.0 maxValue:59.0]; } + (Class)_binderClassForBinding:(CPString)aBinding { - if (aBinding == CPValueBinding || aBinding == CPMinValueBinding || aBinding == CPMaxValueBinding) + if (aBinding === CPValueBinding || aBinding === CPMinValueBinding || aBinding === CPMaxValueBinding) return [_CPStepperValueBinder class]; return [super _binderClassForBinding:aBinding]; @@ -90,7 +89,7 @@ - (CPString)_replacementKeyPathForBinding:(CPString)aBinding { - if (aBinding == CPValueBinding) + if (aBinding === CPValueBinding) return @"doubleValue"; return [super _replacementKeyPathForBinding:aBinding]; @@ -240,7 +239,7 @@ if (![self isEnabled]) return; - if (aSender == _buttonUp) + if (aSender === _buttonUp) [self setDoubleValue:([self doubleValue] + _increment)]; else [self setDoubleValue:([self doubleValue] - _increment)]; @@ -293,7 +292,7 @@ - (void)_updatePlaceholdersWithOptions:(CPDictionary)options forBinding:(CPString)aBinding { - var placeholder = (aBinding == CPMaxValueBinding) ? [_source maxValue] : [_source minValue]; + var placeholder = (aBinding === CPMaxValueBinding) ? [_source maxValue] : [_source minValue]; [super _updatePlaceholdersWithOptions:options];