Closed IngwiePhoenix closed 8 years ago
Not currently. It would need to be inserted by the compiler (as the runtime doesn't know). Objective-C accomplishes this via __FILE__
, __LINE__
, __PRETTY_FUNCTION__
, etc.
Double underscores are reserved for the compiler in ANSI-C, but not in JS, so we would probably use an @
-prefixed keyword:
Perhaps:
@FILE
- Current File
@LINE
- Current Line
@FUNCTION
- Current pretty function (class and selector)
@CLASS
- Current class
@SELECTOR
or @SEL
- Current selector
That sounds pretty solid! :) There is a lot of good stuff comming up to the list for OJ. You have any ToDo? :p
Going with @CLASS
, @SEL
, @FUNCTION
. Holding off on file/line information for now.
Just to reiterate: these are for debugging only. They will report the squeezed symbol name if the squeezer is turned on.
Each of these is transformed into a string by the compiler:
- (void) test {
console.log("Error in " + @FUNCTION + ", Mooooo");
}
Works just fine. :) It is better than having no idea at all.
Is there a good way to pick up the current selector while debugging? For instance:
I am currently debugging my main application, and it would be nice to display the current class/selector to quickly pick up where what is happening.
Kind regards, Ingwie