testing/errors/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use swc_common::errors::{DiagnosticBuilder, Emitter};

pub(crate) mod stderr;

pub(crate) fn multi_emitter(a: Box<dyn Emitter>, b: Box<dyn Emitter>) -> Box<dyn Emitter> {
    Box::new(MultiEmitter { a, b })
}

struct MultiEmitter {
    a: Box<dyn Emitter>,
    b: Box<dyn Emitter>,
}

impl Emitter for MultiEmitter {
    fn emit(&mut self, db: &DiagnosticBuilder<'_>) {
        self.a.emit(db);
        self.b.emit(db);
    }
}