Function deno_ast::parse_program_with_post_process
source · [−]pub fn parse_program_with_post_process(
params: ParseParams,
post_process: impl FnOnce(Program) -> Program
) -> Result<ParsedSource, Diagnostic>
Expand description
Parses the provided information as a program with the option of providing some post-processing to the result.
Example
deno_ast::parse_program_with_post_process(
deno_ast::ParseParams {
specifier: "file:///my_file.ts".to_string(),
media_type: deno_ast::MediaType::TypeScript,
text_info: deno_ast::SourceTextInfo::from_string("".to_string()),
capture_tokens: true,
maybe_syntax: None,
scope_analysis: false,
},
|program| {
// do something with the program here before it gets stored
program
},
);