Skip to content

Add UseMemoDirective and UseNoMemoDirective classes#21796

Open
mattcosta7 wants to merge 3 commits intogithub:mainfrom
mattcosta7:patch-1
Open

Add UseMemoDirective and UseNoMemoDirective classes#21796
mattcosta7 wants to merge 3 commits intogithub:mainfrom
mattcosta7:patch-1

Conversation

@mattcosta7
Copy link
Copy Markdown
Member

@mattcosta7 mattcosta7 commented May 5, 2026

Summary

Adds UseMemoDirective and UseNoMemoDirective classes to the JavaScript QL library so React compiler directives "use memo" and "use no memo" are modeled as known directives.

Changes

  • Add Directive::UseMemoDirective and Directive::UseNoMemoDirective in javascript/ql/lib/semmle/javascript/Stmt.qll
  • Add library tests covering both directives
  • Add a changenote documenting the new classes

Testing

  • Updated javascript/ql/test/library-tests/Directives/tst.js
  • Updated expected results in javascript/ql/test/library-tests/Directives/KnownDirective.expected

@github-actions github-actions Bot added the JS label May 5, 2026
@mattcosta7 mattcosta7 marked this pull request as ready for review May 5, 2026 13:08
Copilot AI review requested due to automatic review settings May 5, 2026 13:08
@mattcosta7 mattcosta7 requested a review from a team as a code owner May 5, 2026 13:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the JavaScript QL statement library with first-class classes for the newer React/compiler-style directives use memo and use no memo, so they are treated like the other known directives already modeled in Stmt.qll.

Changes:

  • Added Directive::UseMemoDirective for "use memo".
  • Added Directive::UseNoMemoDirective for "use no memo".
  • Kept the new directive classes aligned with the existing KnownDirective structure and inline documentation style in Stmt.qll.
Show a summary per file
File Description
javascript/ql/lib/semmle/javascript/Stmt.qll Adds two new documented KnownDirective subclasses for recognized directive strings.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants