Matching hints is done in two passes: fuzzy match, and an untyped ast match. The untyped ast match attempts to match a single hint against a given node in the ast, to avoid attempting every hint against every node, an initial pass (the fuzzy match) is done to eliminate as many cases where there'll never be a match as quickly as possible, so that the ast match is run against as few hints and ast nodes as possible.
The fuzzy match requires two structures to be computed before hand: an abstract syntax array constructed from the ast, and a trie of hints. Both of these structures contain hash codes of the nodes, the hash codes are expected to match when the nodes are equivalent. The matching is done using these hash codes so we end up with a trie of integers searching against an array of integers - which is pretty fast.
Name | Description |
---|---|
checkTrie
Signature: i:int -> trie:Node -> nodeArray:Node [] -> boundVariables:Dictionary |
Compares the hint trie against a given location in the abstract syntax array. |