Query module DeadStoreOfProperty

name
Useless assignment to property
description
An assignment to a property whose value is always overwritten has no effect.
kind
problem
problem.severity
warning
id
js/useless-assignment-to-property
tags
maintainability
precision
high

Imports

DOMProperties

Provides predicates for working with the DOM type hierarchy.

DeadStore

Provides classes and predicates for reasoning about dead stores.

javascript

Provides classes for working with JavaScript programs, as well as JSON, YAML and HTML.

Predicates

isDeadAssignment

Holds if assign1 and assign2 both assign property name, but assign1 is dead because of assign2.

maybeAccessesAssignedPropInBlock

Holds if assign assigns a property name that may be accessed somewhere else in the same block, after indicates if the access happens before or after the node for assign.

maybeAccessesProperty

Holds if e may access a property named name.

noPropAccessBetween

Holds if assign1 and assign2 both assign property name, and the assigned property is not accessed between the two assignments.

postDominatedPropWrite

Holds if assign1 and assign2 both assign property name of the same object, and assign2 post-dominates assign1.

unambiguousPropWrite

Holds if write writes to property name of base, and base is the only base object of write.