insertMatch method

void insertMatch(
  1. Match match
)

Implementation

void insertMatch(Match match) {
  SourceNode? root = findElement(roots, (node) => node.accessor == match.paths[0][0]);

  if (root == null) {
    root = makeNode(null, // parent
        match.paths[0][0], // step
        match.paths[0].length == 1 ? match : null);

    roots.add(root);
  }

  if (match.paths[0].length > 1) {
    root.insertMatch(this, match, 1);
  }
}