[javascriptlint-commit] SF.net SVN: javascriptlint:[347] trunk
Status: Beta
Brought to you by:
matthiasmiller
|
From: <mat...@us...> - 2013-12-07 16:32:57
|
Revision: 347
http://sourceforge.net/p/javascriptlint/code/347
Author: matthiasmiller
Date: 2013-12-07 16:32:54 +0000 (Sat, 07 Dec 2013)
Log Message:
-----------
#46 Function name mismatch warning when assigning to property
Apply attached patched.
Modified Paths:
--------------
trunk/javascriptlint/warnings.py
trunk/tests/warnings/function_name_mismatch.js
trunk/tests/warnings/function_name_missing.js
Modified: trunk/javascriptlint/warnings.py
===================================================================
--- trunk/javascriptlint/warnings.py 2013-10-10 15:28:32 UTC (rev 346)
+++ trunk/javascriptlint/warnings.py 2013-12-07 16:32:54 UTC (rev 347)
@@ -662,6 +662,9 @@
if parent.kids[0].kind == tok.NAME and \
parent.kids[0].opcode == op.SETNAME:
return parent.kids[0].atom
+ if parent.kids[0].kind == tok.DOT and \
+ parent.kids[0].opcode == op.SETPROP:
+ return parent.kids[0].atom
return '<error>'
# Object literal.
Modified: trunk/tests/warnings/function_name_mismatch.js
===================================================================
--- trunk/tests/warnings/function_name_mismatch.js 2013-10-10 15:28:32 UTC (rev 346)
+++ trunk/tests/warnings/function_name_mismatch.js 2013-12-07 16:32:54 UTC (rev 347)
@@ -32,5 +32,14 @@
function x() {
}
+
+ function Class() {
+ }
+ Class.prototype.get = function gt() { /*warning:function_name_mismatch*/
+ return this.value;
+ };
+ Class.prototype.set = function set(value) {
+ this.value = value;
+ };
}
Modified: trunk/tests/warnings/function_name_missing.js
===================================================================
--- trunk/tests/warnings/function_name_missing.js 2013-10-10 15:28:32 UTC (rev 346)
+++ trunk/tests/warnings/function_name_missing.js 2013-12-07 16:32:54 UTC (rev 347)
@@ -26,5 +26,14 @@
function x() {
}
+
+ function Class() {
+ }
+ Class.prototype.get = function () { /*warning:function_name_missing*/
+ return this.value;
+ };
+ Class.prototype.set = function set(value) {
+ this.value = value;
+ };
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|