(binding: Binding)
| 756 | // e.g. `store` read only as `store.add(...)` or `new Store()`, so nothing |
| 757 | // can replace a member its instances run |
| 758 | const readsOnlyMembers = (binding: Binding): boolean => |
| 759 | !binding.writes.length && |
| 760 | binding.references.every(reference => { |
| 761 | const [operand, parent] = operatorOf(reference.id) |
| 762 | return ( |
| 763 | (parent?.type === "MemberExpression" && |
| 764 | parent.object === operand && |
| 765 | !isWriteTarget(parent)) || |
| 766 | (parent?.type === "NewExpression" && parent.callee === operand) |
| 767 | ) |
| 768 | }) |
| 769 | |
| 770 | // e.g. `this.add = add` or `Object.assign(this, methods)` |
| 771 | const replacesMember = (cls: Class, name: string): boolean => { |
no test coverage detected