core Vars not loaded
mfikes opened this issue · 3 comments
If you evaluate an expression which involves a symbol resolving to a Var in cljs.core
, the AST doesn't reflect this. For example map
indicates that the Var is cljs.user/map
.
Weird. In the case of (map inc [1 2 3 4])
, inc loads as cljs.core/inc, but map loads as cljs.user/map.
(reduce + (map inc [1 2 3 4]))
shows cljs.user/reduce and cljs.user/map, but cljs.core/+ and cljs.core/inc.
Output from fiwheel:
WARNING: Use of undeclared Var cljs.user/reduce
WARNING: Can't take value of macro cljs.core/+
WARNING: Use of undeclared Var cljs.user/map
WARNING: Can't take value of macro cljs.core/inc
Any ideas?
@lincoln-b Yes, inc
is a macro-function
To properly resolve map
to cljs.core/map
, you'd need to make sure (cljs.js/empty-state)
has the core analysis cache loaded. (Check out it's implementation and dump-core
.)
I changed the AST pane to draw from cljs.js/analyze-str
instead of (my modification of) cljs.analyzer.utils/to-ast
. That gives us back cljs.core/map
.
Then I wrote a function to recursively dissoc "fluff" keywords from the map -- currently that's :env
, :children
, and :doc
. The list of keywords to dissoc is in rage.utilities/keywords-to-remove
.
Thanks for helping me out with this!