rentzsch/mogenerator — pull request #125 by winitzki (2012-08-16 14:38:32+00:00)
Title: Correct generation of fetch requests with repeated variables

If a CoreData model has a fetch request with a predicate where some variables are repeated, mogenerator will now generate correct Objective-C code.

Example: Suppose a CoreData model has a fetch request with predicate (name==$NAME AND id==$ID ) OR ( surname==$NAME AND id="special"). In this predicate, the variable $NAME is mentioned twice. mogenerator will currently export such a predicate as a function with declaration of this form,

+ (NSArray*)fetchGetWhatever:(NSManagedObjectContext*)moc_ NAME:(NSString*)NAME_ ID:(NSString *)ID_ NAME:(NSString *)NAME_;

This does not compile since the parameter "NAME" is used twice.

My patch corrects this problem and make sure that variables are used only once.