Skip to content

Commit

Permalink
Merge pull request #223 from rwasef1830/bug-214
Browse files Browse the repository at this point in the history
Fix #214 again.
  • Loading branch information
trullock authored Dec 29, 2020
2 parents a9c663b + 32397b0 commit b9430df
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/NUglify.Tests/TestData/JS/Expected/Bugs/Bug214.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export class MyClass{set property(value){}}
export class MyClass{set property(_value){}}
2 changes: 1 addition & 1 deletion src/NUglify.Tests/TestData/JS/Input/Bugs/Bug214.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export class MyClass {
set property(value) { }
set property(_value) { }
}
7 changes: 4 additions & 3 deletions src/NUglify/JavaScript/Visitors/AnalyzeNodeVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2629,9 +2629,10 @@ public override void Visit(FunctionObject node)
if (removeIfUnreferenced)
{
// dont remove `value` from setters even if unused, this is invalid
if ((paramDecl.Binding is BindingIdentifier bi) && bi.Name == "value" &&
node.FunctionType == FunctionType.Setter)
continue;
if ((paramDecl.Binding is BindingIdentifier bi) &&
node.ParameterDeclarations.Count == 1 &&
node.FunctionType == FunctionType.Setter)
continue;

node.ParameterDeclarations.RemoveAt(ndx);
}
Expand Down

0 comments on commit b9430df

Please sign in to comment.