Skip to content

Commit 0fcfb47

Browse files
committed
Sync shared files
1 parent f83df76 commit 0fcfb47

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

javascript/ql/lib/semmle/javascript/frameworks/data/internal/ApiGraphModelsExtensions.qll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,25 @@ extensible predicate typeModel(string type1, string type2, string path);
4545
* Holds if `path` can be substituted for a token `TypeVar[name]`.
4646
*/
4747
extensible predicate typeVariableModel(string name, string path);
48+
49+
/**
50+
* Holds if the given extension tuple `madId` should pretty-print as `model`.
51+
*
52+
* This predicate should only be used in tests.
53+
*/
54+
predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
55+
exists(string type, string path, string kind |
56+
sourceModel(type, path, kind, madId) and
57+
model = "Source: " + type + "; " + path + "; " + kind
58+
)
59+
or
60+
exists(string type, string path, string kind |
61+
sinkModel(type, path, kind, madId) and
62+
model = "Sink: " + type + "; " + path + "; " + kind
63+
)
64+
or
65+
exists(string type, string path, string input, string output, string kind |
66+
summaryModel(type, path, input, output, kind, madId) and
67+
model = "Summary: " + type + "; " + path + "; " + input + "; " + output + "; " + kind
68+
)
69+
}

python/ql/lib/semmle/python/frameworks/data/internal/ApiGraphModelsExtensions.qll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,25 @@ extensible predicate typeModel(string type1, string type2, string path);
4545
* Holds if `path` can be substituted for a token `TypeVar[name]`.
4646
*/
4747
extensible predicate typeVariableModel(string name, string path);
48+
49+
/**
50+
* Holds if the given extension tuple `madId` should pretty-print as `model`.
51+
*
52+
* This predicate should only be used in tests.
53+
*/
54+
predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
55+
exists(string type, string path, string kind |
56+
sourceModel(type, path, kind, madId) and
57+
model = "Source: " + type + "; " + path + "; " + kind
58+
)
59+
or
60+
exists(string type, string path, string kind |
61+
sinkModel(type, path, kind, madId) and
62+
model = "Sink: " + type + "; " + path + "; " + kind
63+
)
64+
or
65+
exists(string type, string path, string input, string output, string kind |
66+
summaryModel(type, path, input, output, kind, madId) and
67+
model = "Summary: " + type + "; " + path + "; " + input + "; " + output + "; " + kind
68+
)
69+
}

0 commit comments

Comments
 (0)