summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/rules/operator-assignment.js
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2016-04-09 14:11:01 +0200
committersilverwind <me@silverwind.io>2016-04-10 11:46:08 +0200
commit2f6ff1bb64ac4f3e201039c8e83f8eb95f73c769 (patch)
tree710fe0778ca523281965244fdca60c4a031980e6 /tools/eslint/lib/rules/operator-assignment.js
parent8f4fdc93f07a06a62d4f867c6e0fd2f6287bb8be (diff)
downloadnode-new-2f6ff1bb64ac4f3e201039c8e83f8eb95f73c769.tar.gz
tools: update ESLint to 2.7.0
PR-URL: https://github.com/nodejs/node/pull/6132 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
Diffstat (limited to 'tools/eslint/lib/rules/operator-assignment.js')
-rw-r--r--tools/eslint/lib/rules/operator-assignment.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/eslint/lib/rules/operator-assignment.js b/tools/eslint/lib/rules/operator-assignment.js
index aa9e032ae2..9656846019 100644
--- a/tools/eslint/lib/rules/operator-assignment.js
+++ b/tools/eslint/lib/rules/operator-assignment.js
@@ -53,13 +53,19 @@ function same(a, b) {
switch (a.type) {
case "Identifier":
return a.name === b.name;
+
case "Literal":
return a.value === b.value;
+
case "MemberExpression":
- // x[0] = x[0]
- // x[y] = x[y]
- // x.y = x.y
+
+ /*
+ * x[0] = x[0]
+ * x[y] = x[y]
+ * x.y = x.y
+ */
return same(a.object, b.object) && same(a.property, b.property);
+
default:
return false;
}