@@ -576,26 +576,32 @@ abstract class AdditionalFlowStep extends DataFlow::Node {
576
576
577
577
/**
578
578
* A collection of pseudo-properties that are used in multiple files.
579
- *
580
- * A pseudo-property represents the location where some value is stored in an object.
581
- *
579
+ *
580
+ * A pseudo-property represents the location where some value is stored in an object.
581
+ *
582
582
* For use with load/store steps in `DataFlow::AdditionalFlowStep` and TypeTracking.
583
583
*/
584
584
module PseudoProperties {
585
+ bindingset [ s]
586
+ private string pseudoProperty ( string s ) { result = "$" + s + "$" }
587
+
588
+ bindingset [ s, v]
589
+ private string pseudoProperty ( string s , string v ) { result = "$" + s + "|" + v + "$" }
590
+
585
591
/**
586
592
* Gets a pseudo-property for the location of elements in a `Set`
587
593
*/
588
- string setElement ( ) { result = "$ setElement$" }
594
+ string setElement ( ) { result = pseudoProperty ( " setElement" ) }
589
595
590
596
/**
591
597
* Gets a pseudo-property for the location of elements in a JavaScript iterator.
592
598
*/
593
- string iteratorElement ( ) { result = "$ iteratorElement$" }
599
+ string iteratorElement ( ) { result = pseudoProperty ( " iteratorElement" ) }
594
600
595
601
/**
596
602
* Gets a pseudo-property for the location of elements in an `Array`.
597
603
*/
598
- string arrayElement ( ) { result = "$ arrayElement$" }
604
+ string arrayElement ( ) { result = pseudoProperty ( " arrayElement" ) }
599
605
600
606
/**
601
607
* Gets a pseudo-property for the location of elements in some array-like object. (Set, Array, or Iterator).
@@ -605,15 +611,15 @@ module PseudoProperties {
605
611
/**
606
612
* Gets a pseudo-property for the location of map values, where the key is unknown.
607
613
*/
608
- string mapValueUnknownKey ( ) { result = "$UnknownMapValue$" }
614
+ string mapValueUnknownKey ( ) { result = pseudoProperty ( "unknownMapValue" ) }
609
615
610
616
/**
611
617
* Gets a pseudo-property for the location of a map value where the key is `key`.
612
618
* The string value of the `key` is encoded in the result, and there is only a result if the string value of `key` is known.
613
619
*/
614
620
pragma [ inline]
615
621
string mapValueKnownKey ( DataFlow:: Node key ) {
616
- exists ( string s | key .mayHaveStringValue ( s ) | result = "$mapValue|" + s + "$" )
622
+ result = pseudoProperty ( "mapValue" , any ( string s | key .mayHaveStringValue ( s ) ) )
617
623
}
618
624
619
625
/**
0 commit comments