mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 06:05:02 +03:00
swc_ecma_transforms:
- remove this parameter from typescript::strip pass (fixes #236)
This commit is contained in:
parent
4dc10d849e
commit
4fddea0bbd
@ -162,6 +162,23 @@ impl Fold<Constructor> for Strip {
|
||||
}
|
||||
}
|
||||
|
||||
impl Fold<Vec<Pat>> for Strip {
|
||||
fn fold(&mut self, pats: Vec<Pat>) -> Vec<Pat> {
|
||||
let mut pats = pats.fold_children(self);
|
||||
|
||||
// Remove this from parameter list
|
||||
pats.retain(|pat| match *pat {
|
||||
Pat::Ident(Ident {
|
||||
sym: js_word!("this"),
|
||||
..
|
||||
}) => false,
|
||||
_ => true,
|
||||
});
|
||||
|
||||
pats
|
||||
}
|
||||
}
|
||||
|
||||
impl Fold<Vec<ModuleItem>> for Strip {
|
||||
fn fold(&mut self, items: Vec<ModuleItem>) -> Vec<ModuleItem> {
|
||||
// First pass
|
||||
|
@ -82,3 +82,9 @@ const a: Types = Types.foo;",
|
||||
"import {Types} from 'other';
|
||||
const a = Types.foo;"
|
||||
);
|
||||
|
||||
to!(
|
||||
issue_236,
|
||||
"function foo(this: any, $scope: angular.IScope){}",
|
||||
"function foo($scope){}"
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user