-
Notifications
You must be signed in to change notification settings - Fork 14
Fix #349: JS generation should check the validity of all levels in a … #350
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…f all levels in a field name
paterczm
reviewed
Mar 6, 2017
| return new IfStatement(new SimpleExpression("typeof this.%s != 'undefined'", var),s); | ||
| StringBuffer b=new StringBuffer(64); | ||
| for(int i=0;i<var.length();i++) { | ||
| } |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this empty loop for?
Contributor
Author
|
Leftover from refactoring. Removed.
…On Mon, Mar 6, 2017 at 10:32 AM, Marek ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In mongo/src/main/java/com/redhat/lightblue/mongo/crud/js/IfStatement.java
<#350 (comment)>
:
> @@ -28,11 +28,27 @@ public IfStatement(Expression test,Statement...s) {
}
public static IfStatement ifDefined(Name var,Statement...s) {
- return new IfStatement(new SimpleExpression("typeof this.%s != 'undefined'", var),s);
+ StringBuffer b=new StringBuffer(64);
+ for(int i=0;i<var.length();i++) {
+ }
What is this empty loop for?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#350 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADgDDRF2Zsmsk90uXWsqNKNMl-k-Ewzsks5rjENHgaJpZM4MUbrt>
.
|
dcrissman
reviewed
Mar 6, 2017
| public void translateJS() throws Exception { | ||
| DBObject obj = expressionTranslator.translate(md, query("{'field':'field7.*.elemf1','op':'=','rfield':'field7.*.elemf2'}")); | ||
| Assert.assertEquals("function() {var r0=false;{if(typeof this.field7 != 'undefined'){for(var ri1=0;ri1<this.field7.length;ri1++){if(typeof this.field7 != 'undefined'){for(var ri2=0;ri2<this.field7.length;ri2++){r0=field7[ri1].elemf1 == field7[ri2].elemf2;if(r0){break;}}}if(r0){break;}}}}return r0;}", | ||
| Assert.assertEquals("function() {var r0=false;{if(typeof this.field7!='undefined'){for(var ri1=0;ri1<this.field7.length;ri1++){if(typeof this.field7!='undefined'){for(var ri2=0;ri2<this.field7.length;ri2++){r0=field7[ri1].elemf1 == field7[ri2].elemf2;if(r0){break;}}}if(r0){break;}}}}return r0;}", |
Member
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth touching this class just for spacing changes?
Contributor
Author
|
The test compares with spaces, so I had to fix the string to match the
generated string.
…On Mon, Mar 6, 2017 at 11:36 AM, Dennis Crissman ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In mongo/src/test/java/com/redhat/lightblue/mongo/crud/TranslatorTest.java
<#350 (comment)>
:
> @@ -326,11 +326,11 @@ public void translateNullReference() throws Exception {
@test
public void translateJS() throws Exception {
DBObject obj = expressionTranslator.translate(md, query("{'field':'field7.*.elemf1','op':'=','rfield':'field7.*.elemf2'}"));
- Assert.assertEquals("function() {var r0=false;{if(typeof this.field7 != 'undefined'){for(var ri1=0;ri1<this.field7.length;ri1++){if(typeof this.field7 != 'undefined'){for(var ri2=0;ri2<this.field7.length;ri2++){r0=field7[ri1].elemf1 == field7[ri2].elemf2;if(r0){break;}}}if(r0){break;}}}}return r0;}",
+ Assert.assertEquals("function() {var r0=false;{if(typeof this.field7!='undefined'){for(var ri1=0;ri1<this.field7.length;ri1++){if(typeof this.field7!='undefined'){for(var ri2=0;ri2<this.field7.length;ri2++){r0=field7[ri1].elemf1 == field7[ri2].elemf2;if(r0){break;}}}if(r0){break;}}}}return r0;}",
Is it worth touching this class just for spacing changes?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#350 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADgDDaDPUIYBdYwJ609Cu1jZZAntXyjEks5rjFIegaJpZM4MUbrt>
.
|
paterczm
approved these changes
Mar 6, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…field name