Add a position-independent digest of the AST (#2962)

Each AST node contains an Option<Digest> which can be optionally set by running compute_digest() over the AST. This will mutate the AST and set the Digest. Fundamentally, the digest is computed from the digest of AST children nodes (using compute_digest) or the explicit raw underlying value.

The underlying hash is changeable by modifying the macro and Digest type alias, and should enable us to determine when an AST -- or fragment of AST -- is the same.

This won't hash the start/end of the AST fragment, so it's, to some extent, position independent. It will hash newlines, comments, etc, which may change in the future depending on how we wind up using this.
This commit is contained in:
Paul Tagliamonte
2024-07-09 12:24:42 -04:00
committed by GitHub
parent e69837a411
commit a82564989e
123 changed files with 18643 additions and 800 deletions

File diff suppressed because it is too large Load Diff