Expand description
Byte spans of the export statements of a file, for a surface that edits source text, such as the quick fix of the language server. The check that each source edit keeps the meaning of the code that it keeps.
fallow fix, the language server and the CI review comments remove code
that the analysis found unused. A guard before an edit protects one known
shape. This module compares the facts of the text before and after the
edit, so that an edit of a new shape gets the same check:
- the edited text parses;
- each kept class element and enum member is still there, in the same class or enum and in the same order;
- each kept enum member keeps its constant value;
- no reference that resolved before the edit is unresolved after it;
- no import stays behind whose binding only a removed export list used.
SourceFacts::exports gives the exported names of the text, so that a
caller can also check the exports that other files use.
Structs§
- Source
Facts - The facts of one file text that the check compares.
Enums§
- Post
Edit Violation - Why the check refuses an edit.
Functions§
- check_
edits - Check the edit of one file:
editsapplied tosource, the text of the file atpath.removabletells which exported names the edit may remove. The language server and the CI review comments call this check before they offer an edit.fallow fixruns the same check over all the files that it edits. - checks_
file - True for a file type that the check parses: JavaScript, TypeScript, and the script blocks of Vue, Svelte and Astro files.