Skip to content

Commit 69564d2

Browse files
committed
Swift: Add a couple of standard Comment subclasses.
1 parent a779f0e commit 69564d2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

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)