diff options
| author | Igor Minar | 2011-08-14 01:26:56 -0700 | 
|---|---|---|
| committer | Igor Minar | 2011-08-15 00:20:48 -0700 | 
| commit | 9d808239b3120b0120f164834ce3012f779c8939 (patch) | |
| tree | ceea216c6797316f39e230a2e006047299033c00 /src/Scope.js | |
| parent | ef01362e441db50758dde41bcdcc20823b55a213 (diff) | |
| download | angular.js-9d808239b3120b0120f164834ce3012f779c8939.tar.bz2 | |
style(*): wrap all assignments in if statements
we commonly assign stuff in if statments like this:
if (variable = someFn()) {
  //do something with variable
}
This results in lint and IDE warnings (did you mean ==?).
It is better to be explicit about our intention and wrap the assignement
into parens:
if ((variable = someFn())) {
  //do something with variable
}
Doing so suppresses warnings + is easier to understand the intention.
I verified that the closure compiler strips the extra parens, so there
is no byte overhead for this safety practice.
We should use this style going forward...
Diffstat (limited to 'src/Scope.js')
| -rw-r--r-- | src/Scope.js | 4 | 
1 files changed, 2 insertions, 2 deletions
| diff --git a/src/Scope.js b/src/Scope.js index b50d6273..6e90ea66 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -343,7 +343,7 @@ Scope.prototype = {              scope.$service('$exceptionHandler')(e);            }          } -        if (watchers = scope.$$watchers) { +        if ((watchers = scope.$$watchers)) {            // process our watches            length = watchers.length;            while (length--) { @@ -372,7 +372,7 @@ Scope.prototype = {              }            } while (scope !== this);          } -      } while (scope = next); +      } while ((scope = next));        if(!(ttl--)) {          throw Error('100 $digest() iterations reached. Aborting!'); | 
