Files
graphify/tests/fixtures/sample.m
T
Synvoya cd3a376030 fix(objc): emit implements edge for protocol-to-protocol adoption
`@protocol Derived <Base>` dropped the protocol-adoption (inheritance)
edge. The protocol_declaration handler in extract_objc walked children
for method declarations but ignored the protocol_reference_list child
that holds the adopted protocols, so no implements edge was ever emitted
for protocol-on-protocol adoption.

The extractor already handled `@interface Foo <Proto>` adoption, but that
nests the protocol name under a parameterized_arguments node; protocol-on-
protocol adoption uses a different grammar node (protocol_reference_list)
whose adopted-name is a direct `identifier` child, so it was never
matched. Walk protocol_reference_list and emit an implements edge for each
adopted protocol, mirroring the @interface handling.

Adds a defined Base/Derived protocol pair to the ObjC fixture and a
regression test asserting the Derived->Base implements edge.
2026-07-01 16:36:48 +01:00

55 lines
711 B
Objective-C

#import <Foundation/Foundation.h>
#import "SampleDelegate.h"
@interface Animal : NSObject <SampleDelegate>
@property (nonatomic, strong) NSString *name;
- (instancetype)initWithName:(NSString *)name;
- (void)speak;
@end
@implementation Animal
- (instancetype)initWithName:(NSString *)name {
self = [super init];
if (self) {
_name = name;
}
return self;
}
- (void)speak {
NSLog(@"%@ makes a sound.", self.name);
}
@end
@interface Dog : Animal
- (void)fetch;
@end
@implementation Dog
- (void)fetch {
[self speak];
NSLog(@"%@ fetches the ball!", self.name);
}
@end
@protocol Base
- (void)baseMethod;
@end
@protocol Derived <Base>
- (void)derivedMethod;
@end