File: traverse.js

package info (click to toggle)
node-webassemblyjs 1.11.4%2Bdfsg%2B~cs10.11.17-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 8,328 kB
  • sloc: javascript: 29,410; makefile: 85; sh: 42; ansic: 16
file content (26 lines) | stat: -rw-r--r-- 608 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// @flow
/* eslint no-unused-vars: off */

type TraverseCallback = (type: string, path: NodePath<Node>) => void;

type NodePathContext<T> = {
  node: T,
  inList: boolean,
  shouldStop: boolean,
  parentPath: ?NodePath<Node>,
  parentKey: ?string,
};

type NodePathMatcher = (NodePath<Node>) => ?boolean;
type NodeLocator = (NodePathMatcher) => ?Node;

type NodePathOperations = {
  findParent: NodeLocator,
  replaceWith: (Node) => void,
  remove: () => void,
  insertBefore: (Node) => void,
  insertAfter: (Node) => void,
  stop: () => void,
};

type NodePath<T> = NodePathContext<T> & NodePathOperations;