#![cfg_attr(coverage_nightly, coverage(off))]
pub use super::ast_typescript_compat::{
analyze_javascript_file, analyze_javascript_file_with_classifier,
analyze_javascript_file_with_complexity,
analyze_javascript_file_with_complexity_and_classifier, analyze_typescript_file,
analyze_typescript_file_with_classifier, analyze_typescript_file_with_complexity,
analyze_typescript_file_with_complexity_and_classifier,
};
pub struct TypeScriptParser {}
impl Default for TypeScriptParser {
fn default() -> Self {
Self::new()
}
}
impl TypeScriptParser {
#[must_use]
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn new() -> Self {
Self {}
}
}
#[derive(Debug, Clone)]
pub struct TypeScriptSymbol {
pub name: String,
pub kind: SymbolKind,
pub line: usize,
pub is_exported: bool,
pub is_async: bool,
pub variants_count: usize,
pub fields_count: usize,
}
#[derive(Debug, Clone)]
pub enum SymbolKind {
Function,
Class,
Interface,
TypeAlias,
Enum,
Variable,
Import,
Export,
Method,
Property,
}
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "path_exists")]
pub async fn analyze_typescript_file_with_complexity_cached(
path: &std::path::Path,
_cache_manager: Option<
std::sync::Arc<crate::services::cache::persistent_manager::PersistentCacheManager>,
>,
) -> Result<crate::services::complexity::FileComplexityMetrics, crate::models::error::TemplateError>
{
analyze_typescript_file_with_complexity(path).await
}
include!("ast_typescript_tests.rs");
include!("ast_typescript_async_tests.rs");