Clojurians
#cljs-dev
<
2016-05-13
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

darwin12:05:21

turns out that DevTools developers just recently added a new experimental feature “sourceNamesResolver”[1]. [1] https://github.com/binaryage/dirac/blob/master/resources/unpacked/devtools/front_end/sources/SourceMapNamesResolver.js

darwin12:05:56

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

darwin12:05:12

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

darwin12:05:01

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

darwin12:05:25

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

darwin12:05:00

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

darwin12:05:48

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

darwin12:05:59

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

darwin12:05:34

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

darwin13:05:11

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

dnolen13:05:07

@darwin nice!