Fork me on GitHub

turns out that DevTools developers just recently added a new experimental feature “sourceNamesResolver”[1]. [1]


it is pretty sophisticated system for resolving original variable names using information from source maps


their use case is for people who want to debug/inspect production code which was minified/closure-compiled. if one has matching source maps setup, devtools will provide user-friendly source panel and variable names using source map info


but this has a nice side effect for clojurescript + sourcemaps, it is able to resolve original variable names:


if you look at the screenshot above, you can see that in my code I defined odd-count? and it got properly resolved by their resolver


unfortunately macro-expanded names are currently broken, but this will be probably easy to fix


I think this will allow me to completely avoid relying on demunge when collecting locals from scope chain


btw. demunge didn’t work that well, because gensym-d names used in macros should not be considered for demunge, but I have no easy way how to detect them


some code uses double underscores, but that is not reliable marker for it


would be great, if gensym could make it easier somehow to detect that the name was generated, but right now I will use source maps info and will skip javascript variables which do not have corresponding source mapping to some clojurescript source code identifier