yui / yuicompressor

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

javascript compression fails when using delete as function name on object #189

Closed jbhamilton closed 9 years ago

jbhamilton commented 9 years ago

When an object has a method named "delete" the compression fails

Ex:

SC.delete('/resource',function(){
});

Error:

[ERROR] in public/js/js.js
  805:18:missing name after . operator
[ERROR] in public/js/js.js
  806:21:syntax error
[ERROR] in public/js/js.js
  807:10:syntax error
[ERROR] in public/js/js.js
  812:1:missing ) after argument list
[ERROR] in public/js/js.js
  812:2:syntax error
[ERROR] in public/js/js.js
  1:0:Compilation produced 5 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 5 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:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
tml commented 9 years ago

Same issue as #47 - requires ES5 support in Rhino to fix.

onurodemis commented 7 years ago

SC['delete']() It should be compiled