refactor($parse): simplifying some while(true) loops

Part of #8901
This commit is contained in:
Jason Bedard
2014-09-01 19:48:57 -07:00
committed by Igor Minar
parent 907b8c1675
commit 1cfd49ddf0

View File

@@ -545,13 +545,10 @@ Parser.prototype = {
filterChain: function() {
var left = this.expression();
var token;
while (true) {
if ((token = this.expect('|'))) {
left = this.binaryFn(left, token.fn, this.filter());
} else {
return left;
}
while ((token = this.expect('|'))) {
left = this.binaryFn(left, token.fn, this.filter());
}
return left;
},
filter: function() {
@@ -624,13 +621,10 @@ Parser.prototype = {
logicalOR: function() {
var left = this.logicalAND();
var token;
while (true) {
if ((token = this.expect('||'))) {
left = this.binaryFn(left, token.fn, this.logicalAND());
} else {
return left;
}
while ((token = this.expect('||'))) {
left = this.binaryFn(left, token.fn, this.logicalAND());
}
return left;
},
logicalAND: function() {