fix(es/codegen): Accept &impl Node instead of impl Node (#8969)

This commit is contained in:
Donny/강동윤 2024-05-23 12:13:13 +09:00 committed by GitHub
parent 85e4eaa507
commit a4567998b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -42,7 +42,7 @@ pub type Result = io::Result<()>;
pub fn to_code_default(
cm: Lrc<SourceMap>,
comments: Option<&dyn Comments>,
node: impl Node,
node: &impl Node,
) -> String {
let mut buf = vec![];
{
@ -59,12 +59,12 @@ pub fn to_code_default(
}
/// Generate a code from a syntax node using default options.
pub fn to_code_with_comments(comments: Option<&dyn Comments>, node: impl Node) -> String {
pub fn to_code_with_comments(comments: Option<&dyn Comments>, node: &impl Node) -> String {
to_code_default(Default::default(), comments, node)
}
/// Generate a code from a syntax node using default options.
pub fn to_code(node: impl Node) -> String {
pub fn to_code(node: &impl Node) -> String {
to_code_with_comments(None, node)
}

View File

@ -76,6 +76,6 @@ fn main() {
// Ensure that we have enough parenthesis.
let program = module.fold_with(&mut fixer(Some(&comments)));
println!("{}", to_code_default(cm, Some(&comments), program));
println!("{}", to_code_default(cm, Some(&comments), &program));
})
}

View File

@ -124,7 +124,7 @@ fn identity(entry: PathBuf) {
Err(_) => return Ok(()),
};
to_code_default(cm.clone(), None, program)
to_code_default(cm.clone(), None, &program)
};
println!("---------------- JS ----------------\n\n{}", js_content);