Skip to content

Commit

Permalink
Merge impl
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Oct 26, 2021
1 parent 70f5583 commit 085df0d
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,48 @@ impl Merge for bool {

impl Merge for Syntax {
fn merge(&mut self, from: &Self) {
*self = *from;
match (&mut *self, from) {
(Syntax::Es(a), Syntax::Es(b)) => {
a.merge(b);
}
(Syntax::Typescript(a), Syntax::Typescript(b)) => {
a.merge(b);
}
_ => {
*self = *from;
}
}
}
}

impl Merge for swc_ecma_parser::EsConfig {
fn merge(&mut self, from: &Self) {
self.jsx |= from.jsx;
self.class_private_props |= from.class_private_props;
self.class_private_methods |= from.class_private_methods;
self.class_props |= from.class_props;
self.fn_bind |= from.fn_bind;
self.decorators |= from.decorators;
self.decorators_before_export |= from.decorators_before_export;
self.export_default_from |= from.export_default_from;
self.export_namespace_from |= from.export_namespace_from;
self.dynamic_import |= from.dynamic_import;
self.nullish_coalescing |= from.nullish_coalescing;
self.optional_chaining |= from.optional_chaining;
self.import_meta |= from.import_meta;
self.top_level_await |= from.top_level_await;
self.import_assertions |= from.import_assertions;
self.static_blocks |= from.static_blocks;
self.private_in_object |= from.private_in_object;
}
}

impl Merge for swc_ecma_parser::TsConfig {
fn merge(&mut self, from: &Self) {
self.tsx |= from.tsx;
self.decorators |= from.decorators;
self.dynamic_import |= from.dynamic_import;
self.import_assertions |= from.import_assertions;
}
}

Expand Down

0 comments on commit 085df0d

Please sign in to comment.