mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
support import in getSimpleAccessPath
This commit is contained in:
committed by
Stephan Brandauer
parent
e7de6cb4a7
commit
e0870e0b96
@@ -469,21 +469,33 @@ private module SyntacticUtilities {
|
||||
if e instanceof VarAccess
|
||||
then result = e.(VarAccess).getName()
|
||||
else
|
||||
if e instanceof AwaitExpr
|
||||
then result = getSimpleAccessPath(e.(AwaitExpr).getOperand().flow()) + ".then()"
|
||||
if e instanceof Import
|
||||
then result = "import(" + getSimpleImportPath(e) + ")"
|
||||
else
|
||||
if node instanceof DataFlow::PropRead
|
||||
then
|
||||
result =
|
||||
getSimpleAccessPath(node.(DataFlow::PropRead).getBase()) + "." +
|
||||
getPropertyNameOrUnknown(node)
|
||||
if e instanceof AwaitExpr
|
||||
then result = getSimpleAccessPath(e.(AwaitExpr).getOperand().flow()) + ".then()"
|
||||
else
|
||||
if node instanceof DataFlow::InvokeNode
|
||||
if node instanceof DataFlow::PropRead
|
||||
then
|
||||
result = getSimpleAccessPath(node.(DataFlow::InvokeNode).getCalleeNode()) + "()"
|
||||
else result = "?"
|
||||
result =
|
||||
getSimpleAccessPath(node.(DataFlow::PropRead).getBase()) + "." +
|
||||
getPropertyNameOrUnknown(node)
|
||||
else
|
||||
if node instanceof DataFlow::InvokeNode
|
||||
then
|
||||
result = getSimpleAccessPath(node.(DataFlow::InvokeNode).getCalleeNode()) + "()"
|
||||
else result = "?"
|
||||
)
|
||||
}
|
||||
|
||||
string getSimpleImportPath(Import i) {
|
||||
if exists(i.getImportedPath().getValue())
|
||||
then
|
||||
exists(string p | p = i.getImportedPath().getValue() |
|
||||
if p.matches(".%") then result = p else result = "!" // hide absolute imports from the ML training
|
||||
)
|
||||
else result = "?"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user