Skip to content

Commit d07e69e

Browse files
committed
JS: Improve handling of destructuring export declaration
1 parent 5eb3067 commit d07e69e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

javascript/ql/src/semmle/javascript/dataflow/internal/InterModuleTypeInference.qll

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,12 @@ private class AnalyzedVariableExport extends AnalyzedPropertyWrite, DataFlow::Va
318318
override predicate writes(AbstractValue baseVal, string propName, DataFlow::AnalyzedNode source) {
319319
baseVal = TAbstractExportsObject(export.getEnclosingModule()) and
320320
propName = name and
321-
source = varDef.getSource().analyze()
321+
(
322+
source = varDef.getSource().analyze()
323+
or
324+
varDef.getTarget() instanceof DestructuringPattern and
325+
source = export.getSourceNode(propName)
326+
)
322327
}
323328

324329
override predicate writesValue(AbstractValue baseVal, string propName, AbstractValue val) {
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
| destructuring-export-client.js:3:8:3:41 | // trac ... ort-foo | Failed to track destructuring-export-foo here. |
2-
| destructuring-export-client.js:4:8:4:41 | // trac ... ort-bar | Failed to track destructuring-export-bar here. |

0 commit comments

Comments
 (0)