mirror of
https://github.com/astral-sh/ruff
synced 2026-01-10 08:04:26 -05:00
Integrate ParseError to compiler-core::Error
This commit is contained in:
22
core/src/error.rs
Normal file
22
core/src/error.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use crate::Location;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Error<T> {
|
||||
pub error: T,
|
||||
pub location: Location,
|
||||
pub source_path: String,
|
||||
}
|
||||
|
||||
impl<T> std::ops::Deref for Error<T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.error
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Error<T> {
|
||||
pub fn error(self) -> T {
|
||||
self.error
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,11 @@
|
||||
#![doc(html_root_url = "https://docs.rs/rustpython-compiler-core/")]
|
||||
|
||||
mod bytecode;
|
||||
mod error;
|
||||
mod location;
|
||||
mod mode;
|
||||
|
||||
pub use bytecode::*;
|
||||
pub use error::Error;
|
||||
pub use location::Location;
|
||||
pub use mode::Mode;
|
||||
|
||||
Reference in New Issue
Block a user