1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use stc_ts_ast_rnode::RMetaPropExpr;
use stc_ts_errors::ErrorKind;
use stc_ts_file_analyzer_macros::validator;
use stc_ts_types::Type;
use swc_common::Spanned;
use swc_ecma_ast::MetaPropKind;
use crate::{analyzer::Analyzer, VResult};
#[validator]
impl Analyzer<'_, '_> {
fn validate(&mut self, e: &RMetaPropExpr) -> VResult<Type> {
match e.kind {
MetaPropKind::NewTarget => {
if !self.ctx.allow_new_target {
self.storage.report(ErrorKind::InvalidUsageOfNewTarget { span: e.span() }.into())
}
Ok(Type::any(e.span, Default::default()))
}
_ => {
todo!("Unsupported meta property {:?}", e)
}
}
}
}