Permalink
Browse files

+ unexpected

  • Loading branch information...
douglascrockford committed Aug 11, 2012
1 parent 656150a commit 421db19f9242546d461dd9f68b381583112a04c5
Showing with 39 additions and 24 deletions.
  1. +39 −24 jslint.js
View
@@ -1,5 +1,5 @@
// jslint.js
-// 2012-07-27
+// 2012-08-11
// Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
@@ -2591,13 +2591,26 @@ klass: do {
}
this.first = expression(150);
this.arity = 'prefix';
- if (this.id === '++' || this.id === '--') {
+ switch (this.id) {
+ case '++':
+ case '--':
if (!option.plusplus) {
warn('unexpected_a', this);
} else if ((!this.first.identifier || this.first.reserved) &&
this.first.id !== '.' && this.first.id !== '[') {
warn('bad_operand', this);
}
+ break;
+ case '+':
+ case '-':
+ switch (this.first.id) {
+ case '[':
+ case '{':
+ case '!':
+ warn('unexpected_a', this.first);
+ break;
+ }
+ break;
}
return this;
};
@@ -6361,27 +6374,29 @@ klass: do {
output[0] = '';
}
- for (i = 0; i < data.functions.length; i += 1) {
- the_function = data.functions[i];
- names = [];
- if (the_function.params) {
- for (j = 0; j < the_function.params.length; j += 1) {
- names[j] = the_function.params[j].string;
- }
- }
- output.push('<dl><address>line ' +
- String(the_function.line) + '</address>' +
- the_function.name.entityify() +
- '(' + names.join(', ') + ')');
- detail('undefined', the_function['undefined']);
- detail('unused', the_function.unused);
- detail('closure', the_function.closure);
- detail('variable', the_function['var']);
- detail('exception', the_function.exception);
- detail('outer', the_function.outer);
- detail('global', the_function.global);
- detail('label', the_function.label);
- output.push('</dl>');
+ if (data.functions) {
+ for (i = 0; i < data.functions.length; i += 1) {
+ the_function = data.functions[i];
+ names = [];
+ if (the_function.params) {
+ for (j = 0; j < the_function.params.length; j += 1) {
+ names[j] = the_function.params[j].string;
+ }
+ }
+ output.push('<dl><address>line ' +
+ String(the_function.line) + '</address>' +
+ the_function.name.entityify() +
+ '(' + names.join(', ') + ')');
+ detail('undefined', the_function['undefined']);
+ detail('unused', the_function.unused);
+ detail('closure', the_function.closure);
+ detail('variable', the_function['var']);
+ detail('exception', the_function.exception);
+ detail('outer', the_function.outer);
+ detail('global', the_function.global);
+ detail('label', the_function.label);
+ output.push('</dl>');
+ }
}
return output.join('');
};
@@ -6422,7 +6437,7 @@ klass: do {
itself.jslint = itself;
- itself.edition = '2012-07-27';
+ itself.edition = '2012-08-11';
return itself;
}());

0 comments on commit 421db19

Please sign in to comment.