yui / yuicompressor

YUI Compressor
http://yui.github.com/yuicompressor/
Other
3.01k stars 665 forks source link

Compressing code with "native" keyword as an object attributes fails #288

Open sandvige opened 7 years ago

sandvige commented 7 years ago

Considering this code:

var a = {};
a.native = 12;
console.log(a);

We have this error when compressing:

xxx@xxx:~/xxx$ java -jar java/yuicompressor.jar --charset UTF-8 --type js x.js
[ERROR] in x.js
  2:9:missing name after operator '.'
[ERROR] in x.js
  1:0:Compilation produced 1 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 1 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(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)

YUICompressor Version: 2.4.8

sandvige commented 7 years ago

Probably a deplucate of this issue https://github.com/yui/yuicompressor/issues/250, but the title wasn't very clear at first look :)