kproc_parser/
kdiagnostic.rs

1use crate::{diagnostic::Diagnostic, proc_macro::TokenTree};
2
3#[derive(Debug, Clone)]
4pub struct KDiagnInfo {
5    inner: Diagnostic,
6    tok: TokenTree,
7}
8
9impl KDiagnInfo {
10    pub fn new(msg: &str, tok: TokenTree, line: String, file: String) -> Self {
11        KDiagnInfo {
12            inner: Diagnostic::new(msg.to_owned(), tok.span(), line, file),
13            tok,
14        }
15    }
16
17    pub fn span(&self) -> TokenTree {
18        self.tok.clone()
19    }
20
21    pub fn warn(mut self) -> Self {
22        self.inner.is_warn();
23        self.clone()
24    }
25
26    pub fn emit(self) {
27        self.inner.emit()
28    }
29}