diff --git a/common/Cargo.toml b/common/Cargo.toml index 72f98499c27..ae6f44ab26b 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" license = "Apache-2.0/MIT" name = "swc_common" repository = "https://github.com/swc-project/swc.git" -version = "0.11.3" +version = "0.11.4" [features] concurrent = ["parking_lot"] diff --git a/common/src/comments.rs b/common/src/comments.rs index e37cc1ffdd3..607c7acfeb9 100644 --- a/common/src/comments.rs +++ b/common/src/comments.rs @@ -230,6 +230,15 @@ impl Comments for SingleThreadedComments { } impl SingleThreadedComments { + /// Creates a new `SingleThreadedComments` from the provided leading and + /// trailing. + pub fn from_leading_and_trailing( + leading: SingleThreadedCommentsMap, + trailing: SingleThreadedCommentsMap, + ) -> Self { + SingleThreadedComments { leading, trailing } + } + /// Takes all the comments as (leading, trailing). pub fn take_all(self) -> (SingleThreadedCommentsMap, SingleThreadedCommentsMap) { (self.leading, self.trailing)