Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 9251605

Browse files
committed
refactor($parse): minor clean-up
1 parent 482a3ae commit 9251605

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/ng/parse.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ AST.prototype = {
398398

399399
filterChain: function() {
400400
var left = this.expression();
401-
var token;
402-
while ((token = this.expect('|'))) {
401+
while (this.expect('|')) {
403402
left = this.filter(left);
404403
}
405404
return left;
@@ -695,6 +694,7 @@ function isStateless($filter, filterName) {
695694
function findConstantAndWatchExpressions(ast, $filter) {
696695
var allConstants;
697696
var argsToWatch;
697+
var isStatelessFilter;
698698
switch (ast.type) {
699699
case AST.Program:
700700
allConstants = true;
@@ -745,7 +745,8 @@ function findConstantAndWatchExpressions(ast, $filter) {
745745
ast.toWatch = [ast];
746746
break;
747747
case AST.CallExpression:
748-
allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;
748+
isStatelessFilter = ast.filter ? isStateless($filter, ast.callee.name) : false;
749+
allConstants = isStatelessFilter;
749750
argsToWatch = [];
750751
forEach(ast.arguments, function(expr) {
751752
findConstantAndWatchExpressions(expr, $filter);
@@ -755,7 +756,7 @@ function findConstantAndWatchExpressions(ast, $filter) {
755756
}
756757
});
757758
ast.constant = allConstants;
758-
ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];
759+
ast.toWatch = isStatelessFilter ? argsToWatch : [ast];
759760
break;
760761
case AST.AssignmentExpression:
761762
findConstantAndWatchExpressions(ast.left, $filter);

0 commit comments

Comments
 (0)