1 module imports.testkwd; 2 3 /****************************************/ 4 5 version(Windows) enum sep = "\\"; else enum sep = "/"; 6 7 enum thatFile = "runnable"~sep~"imports"~sep~"testkwd_file.d"; 8 enum thatMod = "imports.testkwd"; 9 //enum thatLine; 10 enum thatFunc = "imports.testkwd.getCalleeFunc"; 11 enum thatFunc2 = `string imports.testkwd.getCalleeFunc2(int x = 1, string s = "hello")`; 12 13 string getCalleeFile() { return __FILE__; } 14 ulong getCalleeLine() { return __LINE__; } enum thatLine = 14; 15 string getCalleeMod() { return __MODULE__; } 16 string getCalleeFunc() { return __FUNCTION__; } 17 string getCalleeFunc2(int x = 1, string s = "hello") { return __PRETTY_FUNCTION__; } 18 19 /****************************************/ 20 21 string getFuncArgFile (string name = __FILE__ ) { return name; } 22 ulong getFuncArgLine (ulong lnum = __LINE__ ) { return lnum; } 23 string getFuncArgMod (string name = __MODULE__ ) { return name; } 24 string getFuncArgFunc (string name = __FUNCTION__ ) { return name; } 25 string getFuncArgFunc2(string name = __PRETTY_FUNCTION__) { return name; } 26 27 string getFuncTiargFile (string name = __FILE__ )() { return name; } 28 ulong getFuncTiargLine (ulong lnum = __LINE__ )() { return lnum; } 29 string getFuncTiargMod (string name = __MODULE__ )() { return name; } 30 string getFuncTiargFunc (string name = __FUNCTION__ )() { return name; } 31 string getFuncTiargFunc2(string name = __PRETTY_FUNCTION__)() { return name; } 32 33 template getInstTiargFile (string name = __FILE__ ) { enum getInstTiargFile = name; } 34 template getInstTiargLine (ulong lnum = __LINE__ ) { enum getInstTiargLine = lnum; } 35 template getInstTiargMod (string name = __MODULE__ ) { enum getInstTiargMod = name; } 36 template getInstTiargFunc (string name = __FUNCTION__ ) { enum getInstTiargFunc = name; } 37 template getInstTiargFunc2(string name = __PRETTY_FUNCTION__) { enum getInstTiargFunc2 = name; }