diff --git a/crates/oxc_semantic/src/builder.rs b/crates/oxc_semantic/src/builder.rs index ad913d4ca..93fc76e1f 100644 --- a/crates/oxc_semantic/src/builder.rs +++ b/crates/oxc_semantic/src/builder.rs @@ -4,7 +4,7 @@ use std::{cell::RefCell, path::PathBuf, rc::Rc, sync::Arc}; #[allow(clippy::wildcard_imports)] use oxc_ast::{ast::*, AstKind, Trivias, Visit}; -use oxc_diagnostics::Error; +use oxc_diagnostics::{Error, OxcDiagnostic}; use oxc_span::{CompactStr, SourceType, Span}; use oxc_syntax::{ identifier::is_identifier_name, @@ -186,7 +186,7 @@ impl<'a> SemanticBuilder<'a> { } /// Push a Syntax Error - pub fn error>(&self, error: T) { + pub fn error(&self, error: OxcDiagnostic) { self.errors.borrow_mut().push(error.into()); } diff --git a/crates/oxc_transformer/src/context.rs b/crates/oxc_transformer/src/context.rs index 7f13aeab7..a2db69bd1 100644 --- a/crates/oxc_transformer/src/context.rs +++ b/crates/oxc_transformer/src/context.rs @@ -7,7 +7,7 @@ use std::{ use oxc_allocator::Allocator; use oxc_ast::{AstBuilder, Trivias}; -use oxc_diagnostics::Error; +use oxc_diagnostics::{Error, OxcDiagnostic}; use oxc_span::SourceType; use crate::{helpers::module_imports::ModuleImports, TransformOptions}; @@ -15,7 +15,7 @@ use crate::{helpers::module_imports::ModuleImports, TransformOptions}; pub type Ctx<'a> = Rc>; pub struct TransformCtx<'a> { - errors: RefCell>, + errors: RefCell>, pub trivias: &'a Trivias, @@ -66,12 +66,12 @@ impl<'a> TransformCtx<'a> { } pub fn take_errors(&self) -> Vec { - mem::take(&mut self.errors.borrow_mut()) + let errors: Vec = mem::take(&mut self.errors.borrow_mut()); + errors.into_iter().map(Error::from).collect() } /// Add an Error - #[allow(unused)] - pub fn error>(&self, error: T) { - self.errors.borrow_mut().push(error.into()); + pub fn error(&self, error: OxcDiagnostic) { + self.errors.borrow_mut().push(error); } }