trullock / NUglify

NUglify is a HTML, JavaScript and CSS minification Library for .NET (fork of AjaxMin + new features)
Other
398 stars 80 forks source link

Error when minify rest in object destructuring expression #246

Closed dima-lemeshko closed 3 years ago

dima-lemeshko commented 3 years ago

When try to minify js (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#rest_in_object_destructuring):

Uglify.Js("({a, b, ...rest}) => { a; b;}");

Got error: Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at NUglify.JavaScript.Visitors.AnalyzeNodeVisitor.b__54_0(ObjectLiteralProperty property) at NUglify.JavaScript.Syntax.AstNodeList.ForEach[TItem](Action`1 action) at NUglify.JavaScript.Visitors.AnalyzeNodeVisitor.Visit(ObjectLiteral node) at NUglify.JavaScript.Syntax.ObjectLiteral.Accept(IVisitor visitor) at NUglify.JavaScript.Visitors.TreeVisitor.Visit(ParameterDeclaration node) at NUglify.JavaScript.Syntax.ParameterDeclaration.Accept(IVisitor visitor) at NUglify.JavaScript.Visitors.TreeVisitor.Visit(AstNodeList node) at NUglify.JavaScript.Visitors.AnalyzeNodeVisitor.Visit(FunctionObject node) at NUglify.JavaScript.Syntax.FunctionObject.Accept(IVisitor visitor) at NUglify.JavaScript.Visitors.AnalyzeNodeVisitor.Visit(BlockStatement node) at NUglify.JavaScript.JSParser.InternalParse() at NUglify.JavaScript.JSParser.Parse(DocumentContext sourceContext) at NUglify.JavaScript.JSParser.Parse(DocumentContext sourceContext, CodeSettings settings) at NUglify.Uglify.Js(String source, String fileName, CodeSettings codeSettings) at ConsoleApp1.Program.Main(String[] args)

trullock commented 3 years ago

Is this on the latest version?

dima-lemeshko commented 3 years ago

Error reproduced in 1.13.8 (latest) and in 1.9.9 versions.

trullock commented 3 years ago

Fixed in 1.13.9