JS: Improve handling of destructuring export declaration

This commit is contained in:
Asger Feldthaus
2020-11-04 16:16:32 +00:00
parent 5eb3067f58
commit d07e69e529
2 changed files with 6 additions and 3 deletions

View File

@@ -318,7 +318,12 @@ private class AnalyzedVariableExport extends AnalyzedPropertyWrite, DataFlow::Va
override predicate writes(AbstractValue baseVal, string propName, DataFlow::AnalyzedNode source) {
baseVal = TAbstractExportsObject(export.getEnclosingModule()) and
propName = name and
source = varDef.getSource().analyze()
(
source = varDef.getSource().analyze()
or
varDef.getTarget() instanceof DestructuringPattern and
source = export.getSourceNode(propName)
)
}
override predicate writesValue(AbstractValue baseVal, string propName, AbstractValue val) {

View File

@@ -1,2 +0,0 @@
| destructuring-export-client.js:3:8:3:41 | // trac ... ort-foo | Failed to track destructuring-export-foo here. |
| destructuring-export-client.js:4:8:4:41 | // trac ... ort-bar | Failed to track destructuring-export-bar here. |