Skip to content

Commit 52b8fcc

Browse files
owen-mcCopilot
andcommitted
JS: Complete migration to shared SSA
Use shared SSA for definitions, refinements, captures, and local/global data flow. Remove standalone JavaScript liveness, phi insertion, and reaching-definition computation while preserving the public SSA APIs as shared-backed adapters. Register post-update completion positions via `SsaConfig::postUpdateRead` so post-updates take effect after call and assignment completion without adding intermediate reads along ordinary reference chains, and preserve updates across value-preserving reassignments using modeled may-value flow. Keep global continuing-value reads internal so synthesized SSA reads do not leak through `flowsTo`, `getALocalSource`, `analyze`, or `AccessPath::getAReferenceTo`, preserve captured-variable, arrow `super` implicit-`this`, and legacy `Configuration` barrier-guard behavior, and restrict reflective `with`-read shortcuts to type inference. Avoid large intermediate joins in capture-point construction, variable refinement lookup, l-value mapping, and captured assignment inference, add direct SSA definition-to-read steps for type inference, and consolidate cached SSA adapters into `SsaCachedStage`. Update test expectations and add a change note. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 86c189e commit 52b8fcc

41 files changed

Lines changed: 1121 additions & 1955 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: majorAnalysis
3+
---
4+
* JavaScript and TypeScript data flow now use the shared SSA implementation, including refinements and conservative captured-variable definitions. The existing public SSA APIs remain available as shared-backed adapters, and the separate JavaScript SSA computation has been removed. This improves barrier-guard handling across refinements and control-flow joins, reducing false positives when guarded and overwritten values merge, and orders post-update flow after call and assignment completion.

‎javascript/ql/lib/semmle/javascript/GlobalAccessPaths.qll‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module;
66

77
import javascript
88
private import semmle.javascript.dataflow.InferredTypes
9+
private import semmle.javascript.dataflow.internal.DataFlowNode
910
private import semmle.javascript.dataflow.internal.FlowSteps as FlowSteps
1011
private import semmle.javascript.internal.CachedStages
1112

@@ -413,7 +414,8 @@ module AccessPath {
413414
pragma[inline]
414415
DataFlow::Node getAReferenceTo(Root root, string path) {
415416
path = fromReference(result, root) and
416-
not root.isGlobal()
417+
not root.isGlobal() and
418+
not result instanceof TSsaSynthReadNode
417419
}
418420

419421
/**
@@ -436,7 +438,8 @@ module AccessPath {
436438
overlay[caller?]
437439
pragma[inline]
438440
DataFlow::Node getAReferenceTo(string path) {
439-
path = fromReference(result, DataFlow::globalAccessPathRootPseudoNode())
441+
path = fromReference(result, DataFlow::globalAccessPathRootPseudoNode()) and
442+
not result instanceof TSsaSynthReadNode
440443
}
441444

442445
/**

0 commit comments

Comments
 (0)