Skip to content

JavaScript: Restrict InstanceFieldAsPropWrite to fields with initializers. - #920

Merged
semmle-qlci merged 1 commit into
github:masterfrom
xiemaisi:js/field-as-prop-write
Feb 12, 2019
Merged

JavaScript: Restrict InstanceFieldAsPropWrite to fields with initializers.#920
semmle-qlci merged 1 commit into
github:masterfrom
xiemaisi:js/field-as-prop-write

Conversation

@xiemaisi

Copy link
Copy Markdown

As an alternative to #918, we could consider this (partial) revert of 60cef60 (which was added to the PR at my unwise suggestion).

Both in Flow and in TypeScript, a field declaration does not give rise to any actual JavaScript code (in particular, the corresponding property is not initialised to undefined or anything), so there is no reason to model such declarations as PropWrites.

I have verified that this fixes all five dead-store-of-property alerts on g/wabilin/MumiGiveP and g/ionjs-dev/ionjs (the projects we've had reports about on discuss.lgtm.com). A full evaluation is ongoing, but performance looks unaffected so far.

@xiemaisi xiemaisi added the JS label Feb 11, 2019
@xiemaisi
xiemaisi requested a review from a team as a code owner February 11, 2019 08:18
@asger-semmle

Copy link
Copy Markdown
Contributor

LGTM

@xiemaisi

Copy link
Copy Markdown
Author

Performance is unaffected (internal link). As expected, a large number of results go away; the ones I checked are false positives of the kind we saw on LGTM.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants