mirror of
https://github.com/swc-project/swc.git
synced 2024-10-04 12:18:08 +03:00
fix(es/codegen): Accept &impl Node
instead of impl Node
(#8969)
This commit is contained in:
parent
85e4eaa507
commit
a4567998b0
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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));
|
||||
})
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user