diff --git a/src/NUglify.Tests/TestData/JS/Expected/Bugs/Bug214.js b/src/NUglify.Tests/TestData/JS/Expected/Bugs/Bug214.js index 06c357f6..6a49dadb 100644 --- a/src/NUglify.Tests/TestData/JS/Expected/Bugs/Bug214.js +++ b/src/NUglify.Tests/TestData/JS/Expected/Bugs/Bug214.js @@ -1 +1 @@ -export class MyClass{set property(value){}} \ No newline at end of file +export class MyClass{set property(_value){}} \ No newline at end of file diff --git a/src/NUglify.Tests/TestData/JS/Input/Bugs/Bug214.js b/src/NUglify.Tests/TestData/JS/Input/Bugs/Bug214.js index 4f340a17..010a4d7b 100644 --- a/src/NUglify.Tests/TestData/JS/Input/Bugs/Bug214.js +++ b/src/NUglify.Tests/TestData/JS/Input/Bugs/Bug214.js @@ -1,3 +1,3 @@ export class MyClass { - set property(value) { } + set property(_value) { } } \ No newline at end of file diff --git a/src/NUglify/JavaScript/Visitors/AnalyzeNodeVisitor.cs b/src/NUglify/JavaScript/Visitors/AnalyzeNodeVisitor.cs index be82ff08..39337f8a 100644 --- a/src/NUglify/JavaScript/Visitors/AnalyzeNodeVisitor.cs +++ b/src/NUglify/JavaScript/Visitors/AnalyzeNodeVisitor.cs @@ -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); }