diff options
Diffstat (limited to 'tools/eslint/lib/rules/operator-assignment.js')
-rw-r--r-- | tools/eslint/lib/rules/operator-assignment.js | 12 |
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; } |