Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yuicompressor complains findAndModify syntax #83

Closed
rdong opened this issue May 23, 2013 · 3 comments
Closed

yuicompressor complains findAndModify syntax #83

rdong opened this issue May 23, 2013 · 3 comments

Comments

@rdong
Copy link

rdong commented May 23, 2013

The piece of js code is as follows:
.....
a.findAndModify(
{a: a},
[],
{$set: {a: a, b: b, updated_at: new Date()}},
{ new: true, upsert: true }, // line 173
function(err, doc) {
if(err) {
util.logError(logger, "error!", err);
return;
}
}
);
}
.....

got errors when doing compress:
[ERROR] 173:12:invalid property id

[ERROR] 174:26:missing ; before statement

[ERROR] 175:16:missing ; before statement

[ERROR] 176:14:syntax error

[ERROR] 183:5:'try' without 'catch' or 'finally'

[ERROR] 184:9:unlabelled break must be inside loop or switch

[ERROR] 185:7:syntax error

[ERROR] 186:9:missing ; before statement

[ERROR] 209:9:unlabelled break must be inside loop or switch

[ERROR] 211:2:syntax error

[ERROR] 212:8:syntax error

[ERROR] 213:2:syntax error

[ERROR] 1:0:Compilation produced 12 syntax errors.
org.mozilla.javascript.EvaluatorException: Compilation produced 12 syntax errors.
at com.yahoo.platform.yui.compressor.YUICompressor$1.runtimeError(YUICompressor.java:154)
at org.mozilla.javascript.Parser.parse(Parser.java:392)
at org.mozilla.javascript.Parser.parse(Parser.java:337)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.(JavaScriptCompressor.java:533)
at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:131)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)

Please help estimate whether it's a program bug or a wrong usage.
Thanks

@panchenko
Copy link

Rhino does not like "new" here, should be the same as #47

@tml
Copy link
Contributor

tml commented May 23, 2013

Agreed, this is javascript keywords again.

@tml tml closed this as completed May 23, 2013
@rdong
Copy link
Author

rdong commented May 24, 2013

thanks for the comments, quote the new keyword solves the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants