trullock / NUglify

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

object shorthand with string method name haserror==true #340

Open devito opened 2 years ago

devito commented 2 years ago

using v1.20.2

Describe the bug Found that nuglify indicates error when parsing an object shorthand initializer with a quoted method name:

const foo = { '*'() { }, };

const foo = { 'bar'() { }, }; Other styles of object initializing with quoted name work:

const foo = { ['*']() { }, };

const foo = { '*': function() { }, };

const foo = { bar() { }, };

To Reproduce https://gist.github.com/devito/1dae39b9c3c4913d7803784566dbe0e9

Minified output or stack trace

HasError is true with error message: input(1,15-18): run-time error JS1010: Expected identifier: '*'

Excepted output code HasError is false const foo={'*'(){}}

trullock commented 2 years ago

thats truly an odd syntax. Will take a look