mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
tweka fix for evaluated object
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31469 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
de81457c85
commit
990dee6c64
1 changed files with 23 additions and 12 deletions
|
@ -808,12 +808,23 @@ static NSExpression *evaluatedObjectExpression = nil;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) _evaluateLeftValue: (id)leftResult rightValue: (id)rightResult
|
- (BOOL) _evaluateLeftValue: (id)leftResult
|
||||||
|
rightValue: (id)rightResult
|
||||||
|
object: (id)object
|
||||||
{
|
{
|
||||||
unsigned compareOptions = 0;
|
unsigned compareOptions = 0;
|
||||||
BOOL leftIsNil;
|
BOOL leftIsNil;
|
||||||
BOOL rightIsNil;
|
BOOL rightIsNil;
|
||||||
|
|
||||||
|
if (leftResult == evaluatedObjectExpression)
|
||||||
|
{
|
||||||
|
leftResult = object;
|
||||||
|
}
|
||||||
|
if (rightResult == evaluatedObjectExpression)
|
||||||
|
{
|
||||||
|
rightResult = object;
|
||||||
|
}
|
||||||
|
|
||||||
leftIsNil = (leftResult == nil || [leftResult isEqual: [NSNull null]]);
|
leftIsNil = (leftResult == nil || [leftResult isEqual: [NSNull null]]);
|
||||||
rightIsNil = (rightResult == nil || [rightResult isEqual: [NSNull null]]);
|
rightIsNil = (rightResult == nil || [rightResult isEqual: [NSNull null]]);
|
||||||
if (leftIsNil || rightIsNil)
|
if (leftIsNil || rightIsNil)
|
||||||
|
@ -908,18 +919,11 @@ static NSExpression *evaluatedObjectExpression = nil;
|
||||||
id leftValue = [_left expressionValueWithObject: object context: nil];
|
id leftValue = [_left expressionValueWithObject: object context: nil];
|
||||||
id rightValue = [_right expressionValueWithObject: object context: nil];
|
id rightValue = [_right expressionValueWithObject: object context: nil];
|
||||||
|
|
||||||
if (leftValue == evaluatedObjectExpression)
|
|
||||||
{
|
|
||||||
leftValue = object;
|
|
||||||
}
|
|
||||||
if (rightValue == evaluatedObjectExpression)
|
|
||||||
{
|
|
||||||
rightValue = object;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_modifier == NSDirectPredicateModifier)
|
if (_modifier == NSDirectPredicateModifier)
|
||||||
{
|
{
|
||||||
return [self _evaluateLeftValue: leftValue rightValue: rightValue];
|
return [self _evaluateLeftValue: leftValue
|
||||||
|
rightValue: rightValue
|
||||||
|
object: object];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -927,6 +931,11 @@ static NSExpression *evaluatedObjectExpression = nil;
|
||||||
NSEnumerator *e;
|
NSEnumerator *e;
|
||||||
id value;
|
id value;
|
||||||
|
|
||||||
|
if (leftValue == evaluatedObjectExpression)
|
||||||
|
{
|
||||||
|
leftValue = object;
|
||||||
|
}
|
||||||
|
|
||||||
if (![leftValue respondsToSelector: @selector(objectEnumerator)])
|
if (![leftValue respondsToSelector: @selector(objectEnumerator)])
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
|
@ -936,7 +945,9 @@ static NSExpression *evaluatedObjectExpression = nil;
|
||||||
e = [leftValue objectEnumerator];
|
e = [leftValue objectEnumerator];
|
||||||
while ((value = [e nextObject]))
|
while ((value = [e nextObject]))
|
||||||
{
|
{
|
||||||
BOOL eval = [self _evaluateLeftValue: value rightValue: rightValue];
|
BOOL eval = [self _evaluateLeftValue: value
|
||||||
|
rightValue: rightValue
|
||||||
|
object: object];
|
||||||
if (eval != result)
|
if (eval != result)
|
||||||
return eval;
|
return eval;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue