remove-method-call.js 660 B

1234567891011121314151617181920
  1. 'use strict';
  2. const {getParenthesizedRange} = require('../utils/parentheses.js');
  3. const removeMemberExpressionProperty = require('./remove-member-expression-property.js');
  4. function * removeMethodCall(fixer, callExpression, sourceCode) {
  5. const memberExpression = callExpression.callee;
  6. // `(( (( foo )).bar ))()`
  7. // ^^^^
  8. yield removeMemberExpressionProperty(fixer, memberExpression, sourceCode);
  9. // `(( (( foo )).bar ))()`
  10. // ^^
  11. const [, start] = getParenthesizedRange(memberExpression, sourceCode);
  12. const [, end] = callExpression.range;
  13. yield fixer.removeRange([start, end]);
  14. }
  15. module.exports = removeMethodCall;