mirror of
https://github.com/swc-project/swc.git
synced 2024-12-04 07:55:59 +03:00
feat(common): Add an utiliy method for comments (#2002)
swc_common: - Add `SingleThreadedComments::from_leading_and_trailing`.
This commit is contained in:
parent
080b1fa3ac
commit
064416c079
@ -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"]
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user