feat: Implement diagnostic for await outside of async

This commit is contained in:
Shoyu Vanilla 2024-08-05 03:07:24 +09:00
parent aa00ddcf65
commit 8a51419a2d
6 changed files with 187 additions and 17 deletions

View file

@ -24,6 +24,7 @@
//! don't yet have a great pattern for how to do them properly.
mod handlers {
pub(crate) mod await_outside_of_async;
pub(crate) mod break_outside_of_loop;
pub(crate) mod expected_function;
pub(crate) mod inactive_code;
@ -348,6 +349,7 @@ pub fn diagnostics(
for diag in diags {
let d = match diag {
AnyDiagnostic::AwaitOutsideOfAsync(d) => handlers::await_outside_of_async::await_outside_of_async(&ctx, &d),
AnyDiagnostic::ExpectedFunction(d) => handlers::expected_function::expected_function(&ctx, &d),
AnyDiagnostic::InactiveCode(d) => match handlers::inactive_code::inactive_code(&ctx, &d) {
Some(it) => it,