add toString to allow reflection of original traversal methods when wrapping for state

This commit is contained in:
Sebastian McKenzie 2015-11-08 03:41:00 -08:00
parent 8280e18ed4
commit f1f42164fc

View File

@ -174,9 +174,11 @@ function wrapWithState(oldVisitor, state) {
if (!Array.isArray(fns)) continue;
fns = fns.map(function (fn) {
return function (path) {
let newFn = function (path) {
return fn.call(state, path, state);
};
newFn.toString = () => fn.toString();
return newFn;
});
newVisitor[key] = fns;