fix: misleading vars

This commit is contained in:
Myriad-Dreamin 2025-11-16 07:40:31 +08:00
parent 7b8c44ef4c
commit e37f3a891c

View file

@ -882,11 +882,8 @@ impl<F: CompilerFeat, Ext: 'static> ProjectInsState<F, Ext> {
move || { move || {
let compiled = if syntax_only { let compiled = if syntax_only {
let main = graph.snap.world.main(); let main = graph.snap.world.main();
let syntax_error = graph let source_res = graph.world().source(main).at(Span::from_range(main, 0..0));
.world() let syntax_res = source_res.and_then(|source| {
.source(main)
.at(Span::from_range(main, 0..0))
.and_then(|source| {
let errors = source.root().errors(); let errors = source.root().errors();
if errors.is_empty() { if errors.is_empty() {
Ok(()) Ok(())
@ -894,7 +891,7 @@ impl<F: CompilerFeat, Ext: 'static> ProjectInsState<F, Ext> {
Err(errors.into_iter().map(|s| s.into()).collect()) Err(errors.into_iter().map(|s| s.into()).collect())
} }
}); });
let diag = Arc::new(DiagnosticsTask::from_errors(syntax_error.err())); let diag = Arc::new(DiagnosticsTask::from_errors(syntax_res.err()));
CompiledArtifact { CompiledArtifact {
diag, diag,