Merge pull request #9081 from asgerf/js/global-step-refactor

Approved by erik-krogh
This commit is contained in:
CodeQL CI
2022-05-09 06:30:37 -07:00
committed by GitHub
2 changed files with 16 additions and 15 deletions

View File

@@ -56,6 +56,18 @@ private module Cached {
exists(DataFlow::Node mid | pred.flowsTo(mid) | StepSummary::smallstep(mid, succ, summary))
}
pragma[nomagic]
private DataFlow::Node getAGlobalStepPredecessor(string global) {
result = AccessPath::getAnAssignmentTo(global) and
AccessPath::isAssignedInUniqueFile(global)
}
pragma[nomagic]
private DataFlow::Node getAGlobalStepSuccessor(string global) {
result = AccessPath::getAReferenceTo(global) and
AccessPath::isAssignedInUniqueFile(global)
}
/**
* INTERNAL: Use `TypeBackTracker.smallstep()` instead.
*/
@@ -106,20 +118,10 @@ private module Cached {
SharedTypeTrackingStep::step(pred, succ) and
summary = LevelStep()
or
// Store to global access path
exists(string name |
pred = AccessPath::getAnAssignmentTo(name) and
AccessPath::isAssignedInUniqueFile(name) and
succ = DataFlow::globalAccessPathRootPseudoNode() and
summary = StoreStep(name)
)
or
// Load from global access path
exists(string name |
succ = AccessPath::getAReferenceTo(name) and
AccessPath::isAssignedInUniqueFile(name) and
pred = DataFlow::globalAccessPathRootPseudoNode() and
summary = LoadStep(name)
summary = LevelStep() and
exists(string global |
pred = getAGlobalStepPredecessor(global) and
succ = getAGlobalStepSuccessor(global)
)
or
// Store to non-global access path

View File

@@ -44,7 +44,6 @@ connection
| type tracker without call steps | tst.js:120:21:120:24 | conn |
| type tracker without call steps | tst.js:126:22:126:25 | conn |
| type tracker without call steps | tst_conflict.js:6:38:6:77 | api.cha ... ction() |
| type tracker without call steps with property MyApplication.namespace.connection | file://:0:0:0:0 | global access path |
| type tracker without call steps with property conflict | tst.js:63:3:63:25 | MyAppli ... mespace |
| type tracker without call steps with property conflict | tst_conflict.js:6:3:6:25 | MyAppli ... mespace |
| type tracker without call steps with property connection | tst.js:62:3:62:25 | MyAppli ... mespace |