Skip to content

Commit

Permalink
asignment unwrapped
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascrockford committed Jan 31, 2011
1 parent 8eb6227 commit 9d80d80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
15 changes: 9 additions & 6 deletions fulljslint.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// jslint.js
// 2011-01-27
// 2011-01-28

/*
Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
Expand Down Expand Up @@ -3794,10 +3794,13 @@ loop: for (;;) {
if (!id) {
if (nexttoken.id === '(string)') {
id = nexttoken.value;
if (option.adsafe &&
(id.charAt(0) === '_' ||
id.charAt(id.length - 1) === '_')) {
warning(bundle.dangling_a, token);
if (option.safe) {
if (banned[id]) {
warning(bundle.adsafe_a);
} else if (id.charAt(0) === '_' ||
id.charAt(id.length - 1) === '_') {
warning(bundle.dangling_a);
}
}
advance();
} else if (nexttoken.id === '(number)') {
Expand Down Expand Up @@ -6215,7 +6218,7 @@ loop: for (;;) {
};
itself.jslint = itself;

itself.edition = '2011-01-27';
itself.edition = '2011-01-28';

return itself;

Expand Down
7 changes: 1 addition & 6 deletions lint.html
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,7 @@ <h2 id=assignment>=</h2>
...
}</pre>
<p>It is difficult to write correct programs while using idioms that are
hard to distinguish from obvious errors. If you really intend an assignment,
wrap it in another set of parens:</p>
<pre>if ((a = b)) {
...
}</pre>

hard to distinguish from obvious errors.</p>
<h2 id=equal>== and !=</h2>
<p>The <code>==</code> and <code>!=</code> operators do type coercion before
comparing. This is bad because it causes <code>' \t\r\n' == 0</code> to
Expand Down

0 comments on commit 9d80d80

Please sign in to comment.