internal: Compute syntax validation errors on demand

This commit is contained in:
Lukas Wirth 2024-03-04 11:39:38 +01:00
parent 4303e741de
commit c3c9f5ffe1
11 changed files with 45 additions and 44 deletions

View file

@ -303,7 +303,7 @@ fn parse_macro_expansion_error(
macro_call_id: MacroCallId,
) -> ExpandResult<Box<[SyntaxError]>> {
db.parse_macro_expansion(MacroFileId { macro_call_id })
.map(|it| it.0.errors().to_vec().into_boxed_slice())
.map(|it| it.0.errors().into_boxed_slice())
}
pub(crate) fn parse_with_map(
@ -445,7 +445,7 @@ fn macro_arg(
if matches!(loc.def.kind, MacroDefKind::BuiltInEager(..)) {
match parse.errors() {
[] => ValueResult::ok((Arc::new(tt), undo_info)),
errors if errors.is_empty() => ValueResult::ok((Arc::new(tt), undo_info)),
errors => ValueResult::new(
(Arc::new(tt), undo_info),
// Box::<[_]>::from(res.errors()), not stable yet

View file

@ -252,7 +252,7 @@ impl InFile<&SyntaxNode> {
map_node_range_up(db, &db.expansion_span_map(file_id), self.value.text_range())?;
// FIXME: Figure out an API that makes proper use of ctx, this only exists to
// keep pre-token map rewrite behaviour.
// keep pre-token map rewrite behavior.
if !ctx.is_root() {
return None;
}