walk.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. var xtend = require('xtend')
  2. var walk = require('acorn-walk')
  3. var base = xtend(walk.base)
  4. base.Import = function () {}
  5. function simple (node, visitors, baseVisitor, state, override) {
  6. return walk.simple(node, visitors, baseVisitor || base, state, override)
  7. }
  8. function ancestor (node, visitors, baseVisitor, state) {
  9. return walk.ancestor(node, visitors, baseVisitor || base, state)
  10. }
  11. function recursive (node, state, funcs, baseVisitor, override) {
  12. return walk.recursive(node, state, funcs, baseVisitor || base, override)
  13. }
  14. function full (node, callback, baseVisitor, state, override) {
  15. return walk.full(node, callback, baseVisitor || base, state, override)
  16. }
  17. function fullAncestor (node, callback, baseVisitor, state) {
  18. return walk.fullAncestor(node, callback, baseVisitor || base, state)
  19. }
  20. function findNodeAt (node, start, end, test, baseVisitor, state) {
  21. return walk.findNodeAt(node, start, end, test, baseVisitor || base, state)
  22. }
  23. function findNodeAround (node, pos, test, baseVisitor, state) {
  24. return walk.findNodeAround(node, pos, test, baseVisitor || base, state)
  25. }
  26. function findNodeAfter (node, pos, test, baseVisitor, state) {
  27. return walk.findNodeAfter(node, pos, test, baseVisitor || base, state)
  28. }
  29. function findNodeBefore (node, pos, test, baseVisitor, state) {
  30. return walk.findNodeBefore(node, pos, test, baseVisitor || base, state)
  31. }
  32. function make (funcs, baseVisitor) {
  33. return walk.make(funcs, baseVisitor || base)
  34. }
  35. exports.simple = simple
  36. exports.ancestor = ancestor
  37. exports.recursive = recursive
  38. exports.full = full
  39. exports.fullAncestor = fullAncestor
  40. exports.findNodeAt = findNodeAt
  41. exports.findNodeAround = findNodeAround
  42. exports.findNodeAfter = findNodeAfter
  43. exports.findNodeBefore = findNodeBefore
  44. exports.make = make
  45. exports.base = base