File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
javascript/ql/src/semmle/javascript/dataflow Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -741,7 +741,8 @@ module DataFlow {
741741 PropReadAsSourceNode ( ) {
742742 this = TPropNode ( any ( PropertyPattern p ) ) or
743743 this instanceof RestPatternNode or
744- this instanceof ElementPatternNode
744+ this instanceof ElementPatternNode or
745+ this = lvalueNode ( any ( ForOfStmt stmt ) .getLValue ( ) )
745746 }
746747 }
747748
@@ -826,6 +827,24 @@ module DataFlow {
826827 override string getPropertyName ( ) { result = astNode .getImportedName ( ) }
827828 }
828829
830+ /**
831+ * The left-hand side of a `for..of` statement, seen as a property read
832+ * on the object being iterated over.
833+ */
834+ private class ForOfLvalueAsPropRead extends PropRead {
835+ ForOfStmt stmt ;
836+
837+ ForOfLvalueAsPropRead ( ) {
838+ this = lvalueNode ( stmt .getLValue ( ) )
839+ }
840+
841+ override Node getBase ( ) { result = stmt .getIterationDomain ( ) .flow ( ) }
842+
843+ override Expr getPropertyNameExpr ( ) { none ( ) }
844+
845+ override string getPropertyName ( ) { none ( ) }
846+ }
847+
829848 /**
830849 * A data flow node representing an unused parameter.
831850 *
You can’t perform that action at this time.
0 commit comments