@@ -434,7 +434,7 @@ - (void)addTopicsFromRTFFile:(NSString *)rtfFile underHeading:(NSString *)topLev
434434
435435 // NSLog(@"topic function name: %@, line: %@", callName, line);
436436
437- // check for a built-in function signature that matches and substitute it in
437+ // Check for a built-in function signature that matches and substitute it in
438438 if (functionList)
439439 {
440440 std::string function_name ([callName UTF8String ]);
@@ -485,7 +485,7 @@ - (void)addTopicsFromRTFFile:(NSString *)rtfFile underHeading:(NSString *)topLev
485485
486486 // NSLog(@"topic method name: %@, line: %@", callName, line);
487487
488- // check for a built-in method signature that matches and substitute it in
488+ // Check for a built-in method signature that matches and substitute it in
489489 if (methodList)
490490 {
491491 std::string method_name ([callName UTF8String ]);
@@ -513,6 +513,10 @@ - (void)addTopicsFromRTFFile:(NSString *)rtfFile underHeading:(NSString *)topLev
513513 }
514514 else
515515 {
516+ // BCH 3 April 2022: I don't think there's any reason why we can't have more than one method with the same name,
517+ // but with different signatures, as long as they are not in the same class; we can't handle overloading, but
518+ // method lookup is within-class. So this code could be generalized as the property lookup code below was; I just
519+ // haven't bothered to do so.
516520 NSLog (@" *** method signature mismatch:\n old: %@ \n new: %@ " , oldSignatureString, newSignatureString);
517521 }
518522 }
@@ -536,41 +540,46 @@ - (void)addTopicsFromRTFFile:(NSString *)rtfFile underHeading:(NSString *)topLev
536540
537541 // NSLog(@"topic property name: %@, line: %@", callName, line);
538542
539- // check for a built-in property signature that matches and substitute it in
543+ // Check for a built-in property signature that matches and substitute it in. Note that we accept a match from any property in any class
544+ // API as long as the signature matches; we do not rigorously check that the API within a given class matches between signature and doc.
545+ // This is mostly not a problem because it is quite rare for the same property name to be used with more than one signature.
540546 if (propertyList)
541547 {
542548 std::string property_name ([callName UTF8String ]);
543- EidosPropertySignature_CSP property_signature = nullptr ;
549+ bool found_match = false , found_mismatch = false ;
550+ NSString *oldSignatureString = nullptr ;
551+ NSString *newSignatureString = nullptr ;
544552
545553 for (auto signature_iter = propertyList->begin (); signature_iter != propertyList->end (); signature_iter++)
546554 if ((*signature_iter)->property_name_ .compare (property_name) == 0 )
547555 {
548- property_signature = *signature_iter;
549- break ;
550- }
551-
552- if (property_signature)
553- {
554- NSAttributedString *attrSig = [NSAttributedString eidosAttributedStringForPropertySignature: property_signature.get () size: 11.0 ];
555- NSString *oldSignatureString = [lineAttrString string ];
556- NSString *newSignatureString = [attrSig string ];
557-
558- if ([oldSignatureString isEqualToString: newSignatureString])
559- {
560- // NSLog(@"signature match for method %@", callName);
556+ EidosPropertySignature_CSP candidate_signature = *signature_iter;
557+ NSAttributedString *attrSig = [NSAttributedString eidosAttributedStringForPropertySignature: candidate_signature.get () size: 11.0 ];
561558
562- // Replace the signature line from the RTF file with the syntax-colored version
563- lineAttrString = attrSig;
564- }
565- else
566- {
567- NSLog (@" *** property signature mismatch:\n old: %@ \n new: %@ " , oldSignatureString, newSignatureString);
559+ oldSignatureString = [lineAttrString string ];
560+ newSignatureString = [attrSig string ];
561+
562+ if ([oldSignatureString isEqualToString: newSignatureString])
563+ {
564+ // NSLog(@"signature match for method %@", callName);
565+
566+ // Replace the signature line from the RTF file with the syntax-colored version
567+ lineAttrString = attrSig;
568+ found_match = true ;
569+ break ;
570+ }
571+ else
572+ {
573+ // If we find a mismatched signature but no matching signature, that's probably an error in either the doc or
574+ // the signature, unless we find a match later on with a different signature for the same property name.
575+ found_mismatch = true ;
576+ }
568577 }
569- }
570- else
571- {
578+
579+ if (found_mismatch && !found_match)
580+ NSLog (@" *** property signature mismatch:\n old: %@ \n new: %@ " , oldSignatureString, newSignatureString);
581+ else if (!found_match)
572582 NSLog (@" *** no property signature found for property name %@ " , callName);
573- }
574583 }
575584
576585 topicItemKey = [NSString stringWithFormat: @" %@ %@ " , callName, readOnlyName];
@@ -1253,6 +1262,7 @@ - (void)drawRow:(NSInteger)rowIndex clipRect:(NSRect)clipRect
12531262 @" –\u00A0 addRecombinant()" ,
12541263 @" –\u00A0 addSelfed()" ,
12551264 @" –\u00A0 removeSubpopulation()" ,
1265+ @" –\u00A0 killIndividuals()" ,
12561266 @" –\u00A0 takeMigrants()" ,
12571267 @" 8. reproduction() callbacks" ,
12581268 @" 10. survival() callbacks"
0 commit comments