URL:
<http://savannah.gnu.org/bugs/?31381>
Summary: The NSPredicate class using Keyword `SELF` does
not work correctly.
Project: GNUstep
Submitted by: tsomeqdev
Submitted on: 2010年10月20日 07時32分00秒
Category: Base/Foundation
Severity: 3 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
I am afraid there is a bug in the NSPredicate class.
The expected result of exec below is output of "1", but actual result is
"0".
--
NSString* fmt = @"SELF == 'aaa'";
NSPredicate* predicate = [NSPredicate predicateWithFormat:fmt] ;
BOOL ok = [predicate evaluateWithObject:@"aaa"];
NSLog(@"[predicate evaluateWithObject:@\"aaa\"] -> %d", ok);
--
I think the problem is in :
File: NSPredicate.m
Implementation GSEvaluatedObjectExpression
Method -(id)expressionValueWithObject:(id)obj context:(NSDictionary*)info
Index: NSPredicate.m
=============================================
--- NSPredicate.m (revision 30789)
+++ NSPredicate.m (working copy)
@@ -1174,7 +1174,7 @@
- (id) expressionValueWithObject: (id)object
context: (NSMutableDictionary *)context
{
- return object;
+ return self;
}
=====================
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?31381>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep