yui / yuicompressor

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

not working with rxjs .do operator #303

Open andrea-veritas opened 6 years ago

andrea-veritas commented 6 years ago

I have a data stream which is processed by rxjs. When I used the do operator (the side-effect operator), I got the following error message:

[ERROR] in home-attendance.test.js
  237:16:missing name after . operator
[ERROR] in home-attendance.test.js
  241:27:missing ; before statement
[ERROR] in home-attendance.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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)

the code is something like:


Rx.Observable.create(emitter)
.someTransformationOperators
.do(sideEffectFunction) // this is where the error occurs
.someOtherTransformationOperators
.subscribe(); 

And I have to use map instead of do, like this:


Rx.Observable.create(emitter)
.someTransformationOperators
.map(
function(e){
sideEffectFunction(e);   // Yes, yuicompressor works.
return e;
}
)
.someOtherTransformationOperators
.subscribe(); 

But it is ugly. Hope it will be fixed.

tonysamperi commented 4 years ago

I'm experiencing the same, with RxJS 6 and a line which goes:

this.groups.delete(something)

I don't want to edit manually these lines to write them as

this.groups["delete"](something)

What can I do?