Implementing custom requires directive

I would like to implement a requires directive (one that doesn’t require me to extend a type but just to fetch another field before)

Where can I find the source code for the current @require directive?