mirror of
https://github.com/github/codeql.git
synced 2026-04-30 03:05:15 +02:00
add support for the Subclass token
This commit is contained in:
@@ -57,6 +57,9 @@ API::Node getExtraSuccessorFromNode(API::Node node, AccessPathToken token) {
|
||||
or
|
||||
token.getName() = "Awaited" and
|
||||
result = node.getAwaited()
|
||||
or
|
||||
token.getName() = "Subclass" and
|
||||
result = node.getASubclass*()
|
||||
// Some features don't have MaD tokens yet, they would need to be added to API-graphs first.
|
||||
// - decorators ("DecoratedClass", "DecoratedMember", "DecoratedParameter")
|
||||
// - Array/Map elements ("ArrayElement", "Element", "MapKey", "MapValue")
|
||||
|
||||
@@ -40,6 +40,7 @@ isSource
|
||||
| test.py:25:34:25:39 | ControlFlowNode for second | test-source |
|
||||
| test.py:39:11:39:20 | ControlFlowNode for Await | test-source |
|
||||
| test.py:41:8:41:27 | ControlFlowNode for Attribute() | test-source |
|
||||
| test.py:46:7:46:16 | ControlFlowNode for SubClass() | test-source |
|
||||
syntaxErrors
|
||||
| Member[foo |
|
||||
| Member[foo] .Member[bar] |
|
||||
|
||||
@@ -38,4 +38,9 @@ async def async_func():
|
||||
prom = CommonTokens.makePromise(1);
|
||||
val = await prom
|
||||
|
||||
inst = CommonTokens.Class()
|
||||
inst = CommonTokens.Class()
|
||||
|
||||
class SubClass (CommonTokens.Super):
|
||||
pass
|
||||
|
||||
sub = SubClass()
|
||||
@@ -54,6 +54,7 @@ class Sinks extends ModelInput::SinkModelCsv {
|
||||
}
|
||||
|
||||
// TODO: Commonly used tokens
|
||||
// TODO: Should `instance()` be shorthand for `subClass*().getReturn()`?
|
||||
// TODO: Uniform tokens for fields
|
||||
// TODO: Non-positional arguments (including Named parameters)
|
||||
// TODO: Any argument
|
||||
@@ -74,6 +75,7 @@ class Sources extends ModelInput::SourceModelCsv {
|
||||
// Common tokens.
|
||||
"testlib;;Member[CommonTokens].Member[makePromise].ReturnValue.Awaited;test-source", //
|
||||
"testlib;;Member[CommonTokens].Member[Class].Instance;test-source", //
|
||||
"testlib;;Member[CommonTokens].Member[Super].Subclass.Instance;test-source", //
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user