Files
CHOMPStation2/code/_helpers/nameof.dm
2024-10-25 21:39:18 +02:00

12 lines
422 B
Plaintext

/**
* NAMEOF: Compile time checked variable name to string conversion
* evaluates to a string equal to "X", but compile errors if X isn't a var on datum.
* datum may be null, but it does need to be a typed var.
**/
#define NAMEOF(datum, X) (#X || ##datum.##X)
/**
* NAMEOF that actually works in static definitions because src::type requires src to be defined
*/
#define NAMEOF_STATIC(datum, X) (nameof(type::##X))