Skip to content

Commit d3e5449

Browse files
authored
Merge pull request #9979 from MathiasVP/add-inline-expectations-framework-to-Swift
Swift: Add InlineExpectationsTest framework
2 parents a779f0e + b20b0a0 commit d3e5449

File tree

4 files changed

+431
-1
lines changed

4 files changed

+431
-1
lines changed

config/identical-files.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@
392392
"python/ql/test/TestUtilities/InlineExpectationsTest.qll",
393393
"ruby/ql/test/TestUtilities/InlineExpectationsTest.qll",
394394
"ql/ql/test/TestUtilities/InlineExpectationsTest.qll",
395-
"go/ql/test/TestUtilities/InlineExpectationsTest.qll"
395+
"go/ql/test/TestUtilities/InlineExpectationsTest.qll",
396+
"swift/ql/test/TestUtilities/InlineExpectationsTest.qll"
396397
],
397398
"C++ ExternalAPIs": [
398399
"cpp/ql/src/Security/CWE/CWE-020/ExternalAPIs.qll",

swift/ql/lib/codeql/swift/elements/Comment.qll

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,32 @@ class Comment extends CommentBase {
44
/** toString */
55
override string toString() { result = getText() }
66
}
7+
8+
class SingleLineComment extends Comment {
9+
SingleLineComment() {
10+
this.getText().matches("//%") and
11+
not this instanceof SingleLineDocComment
12+
}
13+
}
14+
15+
class MultiLineComment extends Comment {
16+
MultiLineComment() {
17+
this.getText().matches("/*%") and
18+
not this instanceof MultiLineDocComment
19+
}
20+
}
21+
22+
class DocComment extends Comment {
23+
DocComment() {
24+
this instanceof SingleLineDocComment or
25+
this instanceof MultiLineDocComment
26+
}
27+
}
28+
29+
class SingleLineDocComment extends Comment {
30+
SingleLineDocComment() { this.getText().matches("///%") }
31+
}
32+
33+
class MultiLineDocComment extends Comment {
34+
MultiLineDocComment() { this.getText().matches("/**%") }
35+
}

0 commit comments

Comments
 (0)