Cuckoo
Cuckoo copied to clipboard
Compiler custom flags are not supported by Cuckoo generator
Hi!
I have protocols which use Compiler custom flags. I have code similar to next one:
protocol Boo {
func doesBoo(arg: Int64)
#if FEATURE_FLAG
func doesBooForFeature(arg: Int64)
#endif
}
extension Boo {
func doesBoo(arg: Int64) {
doesBoo(arg: arg)
}
#if FEATURE_FLAG
func doesBooForFeature(arg: Int64) {
doesBooForFeature(arg: arg)
}
#endif
}
When I mock this code with FEATURE_FLAG disabled I get next error:
/path/to/mock/GeneratedMocks.swift:1757:45 Value of type 'any Boo' has no member 'doesBooForFeature'
I didn't found any reference to custom flags in Generator code/doc.
Could you help me please to understand is there any functionality for it? If not can it be supported in future?
Hey, this functionality probably isn't supported in Cuckoo. It might be easier to add it to the SwiftSyntax version I've been cooking up, but I haven't gotten around to finishing that up and releasing as Cuckoo 2.0 yet. 🙂
I've looked into implementing this and as it stands it will be a bit harder to add than I initially thought. Mainly because of #elseif
that can be added into the mix. I'll keep it in mind though.
2 likes on that previous issue, so this might be useful to users, but I'm not sure if I'm able to add support for it before converting the generator to use SwiftFormat instead of Sourcery.