mirror of
https://github.com/github/codeql.git
synced 2026-05-30 02:51:24 +02:00
Adds `ImportStmt` and `ImportStarStmt` wrappers in `AstNodeImpl.qll`. For each `Alias` in an import statement, both the value (module/member expression) and the bound `asname` Name become children of the CFG node for the import statement, in evaluation order. Without this, every `Name` introduced by `import` / `from .. import ..` lacked a CFG node, even though `Name.defines(v)` returns true for it on the AST side. This was the highest-volume gap: 20,332 missing import aliases across CPython. Removes the corresponding MISSING: annotations from imports.py. Verified: all 24 ControlFlow/evaluation-order tests still pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
15 lines
443 B
Python
15 lines
443 B
Python
# Import aliases — all bound names below are now reachable via the new
|
|
# CFG's `ImportStmt` wrapper.
|
|
|
|
import os # $ cfgdefines=os
|
|
import os.path # $ cfgdefines=os
|
|
import os as o # $ cfgdefines=o
|
|
from os import path # $ cfgdefines=path
|
|
from os import path as p # $ cfgdefines=p
|
|
from os import sep, linesep # $ cfgdefines=sep cfgdefines=linesep
|
|
from os import (
|
|
getcwd, # $ cfgdefines=getcwd
|
|
getcwdb, # $ cfgdefines=getcwdb
|
|
)
|
|
|