mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +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
1b0e3dbcda
commit
092e9227b5
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;
|
||||
BOOL leftIsNil;
|
||||
BOOL rightIsNil;
|
||||
|
||||
if (leftResult == evaluatedObjectExpression)
|
||||
{
|
||||
leftResult = object;
|
||||
}
|
||||
if (rightResult == evaluatedObjectExpression)
|
||||
{
|
||||
rightResult = object;
|
||||
}
|
||||
|
||||
leftIsNil = (leftResult == nil || [leftResult isEqual: [NSNull null]]);
|
||||
rightIsNil = (rightResult == nil || [rightResult isEqual: [NSNull null]]);
|
||||
if (leftIsNil || rightIsNil)
|
||||
|
@ -908,18 +919,11 @@ static NSExpression *evaluatedObjectExpression = nil;
|
|||
id leftValue = [_left expressionValueWithObject: object context: nil];
|
||||
id rightValue = [_right expressionValueWithObject: object context: nil];
|
||||
|
||||
if (leftValue == evaluatedObjectExpression)
|
||||
{
|
||||
leftValue = object;
|
||||
}
|
||||
if (rightValue == evaluatedObjectExpression)
|
||||
{
|
||||
rightValue = object;
|
||||
}
|
||||
|
||||
if (_modifier == NSDirectPredicateModifier)
|
||||
{
|
||||
return [self _evaluateLeftValue: leftValue rightValue: rightValue];
|
||||
return [self _evaluateLeftValue: leftValue
|
||||
rightValue: rightValue
|
||||
object: object];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -927,6 +931,11 @@ static NSExpression *evaluatedObjectExpression = nil;
|
|||
NSEnumerator *e;
|
||||
id value;
|
||||
|
||||
if (leftValue == evaluatedObjectExpression)
|
||||
{
|
||||
leftValue = object;
|
||||
}
|
||||
|
||||
if (![leftValue respondsToSelector: @selector(objectEnumerator)])
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
|
@ -936,7 +945,9 @@ static NSExpression *evaluatedObjectExpression = nil;
|
|||
e = [leftValue objectEnumerator];
|
||||
while ((value = [e nextObject]))
|
||||
{
|
||||
BOOL eval = [self _evaluateLeftValue: value rightValue: rightValue];
|
||||
BOOL eval = [self _evaluateLeftValue: value
|
||||
rightValue: rightValue
|
||||
object: object];
|
||||
if (eval != result)
|
||||
return eval;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue