var Foo = {
/*! keep comment before an object method */
bar: function() {
var a = 1;
}
}
Result:
$ java -jar yuicompressor-2.4.8.jar yui-test.js
[ERROR] in yui-test.js
3:21:invalid property id
[ERROR] in yui-test.js
8:1:syntax error
[ERROR] in yui-test.js
1:0:Compilation produced 2 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 2 syntax errors.
at com.yahoo.platform.yui.compressor.YUICompressor$1.runtimeError(YUICompressor.java:172)
at org.mozilla.javascript.Parser.parse(Parser.java:396)
at org.mozilla.javascript.Parser.parse(Parser.java:340)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:315)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:536)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
However, placing the comment inside the function works as expected.
var Foo = {
bar: function() {
/*! keep comment */
var a = 1;
}
}
Test file:
Result:
However, placing the comment inside the function works as expected.
Gives:
Also reproducible with latest on master.