3 // Transition from global 'self' to local 'this'
5 [[alias("self")]] entity __self;
7 // Step 1: auto oldself
10 #define SELFPARAM() noref entity this = __self
11 #define setself(s) (__self = s)
14 noref string self_str;
15 #define SELFPARAM() self_str = "self"; noref entity this = __self
16 #define setself(s) (self_str = #s, __self = s)
17 #define self (print(__SOURCELOC__, ": ", self_str, "\n"), __self)
21 // Step 2: check SELFPARAM() is present for functions that use self
23 #define SELFPARAM() [[alias("__self")]] noref entity this = __self
24 #define setself(s) (__self = s)
30 #define SELFPARAM() noref const entity this = __self
31 entity setself(entity e) { return self = e; }
32 entity getself() { return self; }
33 #define self getself()
36 // Step 4: enable when possible
37 // TODO: Remove SELFPARAM in favor of a parameter
39 #define SELFPARAM() noref const entity this = __self