[javascriptlint-commit] SF.net SVN: javascriptlint:[222] trunk
Status: Beta
Brought to you by:
matthiasmiller
|
From: <mat...@us...> - 2008-08-26 16:06:36
|
Revision: 222
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=222&view=rev
Author: matthiasmiller
Date: 2008-08-26 16:06:32 +0000 (Tue, 26 Aug 2008)
Log Message:
-----------
unreferenced_identifier: handle x++ and x--
Modified Paths:
--------------
trunk/pyjsl/lint.py
trunk/tests/warnings/unreferenced_identifier.js
Modified: trunk/pyjsl/lint.py
===================================================================
--- trunk/pyjsl/lint.py 2008-08-26 15:10:59 UTC (rev 221)
+++ trunk/pyjsl/lint.py 2008-08-26 16:06:32 UTC (rev 222)
@@ -142,7 +142,7 @@
resolved = self.resolve_identifier(name)
if resolved:
# Make sure this isn't an assignment.
- if node.parent.kind == tok.ASSIGN and \
+ if node.parent.kind in (tok.ASSIGN, tok.INC, tok.DEC) and \
node.node_index == 0 and \
node.parent.parent.kind == tok.SEMI:
continue
Modified: trunk/tests/warnings/unreferenced_identifier.js
===================================================================
--- trunk/tests/warnings/unreferenced_identifier.js 2008-08-26 15:10:59 UTC (rev 221)
+++ trunk/tests/warnings/unreferenced_identifier.js 2008-08-26 16:06:32 UTC (rev 222)
@@ -59,6 +59,19 @@
var assigned_but_ref;
(assigned_but_ref = callback)();
+ /* Test increment and decrement. */
+ var unref_inc; /*warning:unreferenced_identifier*/
+ unref_inc++;
+ var unref_dec; /*warning:unreferenced_identifier*/
+ unref_dec--;
+
+ var tmp;
+ var ref_inc;
+ tmp = ref_inc++; /*warning:inc_dec_within_stmt*/
+ var ref_dec;
+ tmp = ref_dec--; /*warning:inc_dec_within_stmt*/
+ tmp = -tmp;
+
/* Test nested scopes. */
function get_callback(parm) {
return function() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|