Permalink
Browse files

String("string".toString())

  • Loading branch information...
douglascrockford committed Oct 18, 2012
1 parent 28fce71 commit 9b7ffb9e50e7dceab39586b8efda1aec64c6814c
Showing with 18 additions and 9 deletions.
  1. +18 −9 jslint.js
View
@@ -1,5 +1,5 @@
// jslint.js
-// 2012-10-11
+// 2012-10-18
// Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
@@ -3609,6 +3609,8 @@ klass: do {
if (typeof left === 'object') {
if (left.string === 'parseInt' && p.length === 1) {
warn('radix', left);
+ } else if (left.string === 'String' && p.length >= 1 && p[0].id === '(string)') {
+ warn('unexpected_a', left);
}
if (!option.evil) {
if (left.string === 'eval' || left.string === 'Function' ||
@@ -3625,13 +3627,20 @@ klass: do {
left.id !== '?') {
warn('bad_invocation', left);
}
- if (left.id === '.' && p.length > 0 &&
- left.first && left.first.first &&
- are_similar(p[0], left.first.first)) {
- if (left.second.string === 'call' ||
- (left.second.string === 'apply' && (p.length === 1 ||
- (p[1].arity === 'prefix' && p[1].id === '[')))) {
- warn('unexpected_a', left.second);
+ if (left.id === '.') {
+ if (p.length > 0 &&
+ left.first && left.first.first &&
+ are_similar(p[0], left.first.first)) {
+ if (left.second.string === 'call' ||
+ (left.second.string === 'apply' && (p.length === 1 ||
+ (p[1].arity === 'prefix' && p[1].id === '[')))) {
+ warn('unexpected_a', left.second);
+ }
+ }
+ if (left.second.string === 'toString') {
+ if (left.first.id === '(string)' || left.first.id === '(number)') {
+ warn('unexpected_a', left.second);
+ }
}
}
}
@@ -6451,7 +6460,7 @@ klass: do {
itself.jslint = itself;
- itself.edition = '2012-10-11';
+ itself.edition = '2012-10-18';
return itself;
}());

0 comments on commit 9b7ffb9

Please sign in to comment.