Skip to content

Commit d519f79

Browse files
geoffw0hvitved
andauthored
Update ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll
Co-authored-by: Tom Hvitved <hvitved@github.com>
1 parent 72f1a0d commit d519f79

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

ruby/ql/lib/utils/test/internal/InlineExpectationsTestImpl.qll

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@ module Impl implements InlineExpectationsTestSig {
1212
* A class representing comments that may contain inline expectations (Ruby line comments and ERB comments).
1313
*/
1414
class ExpectationComment extends TAnyComment {
15+
Ruby::Comment asRubyComment() { this = RubyComment(result) }
16+
17+
R::ErbComment asErbComment() { this = ErbComment(result) }
18+
1519
string toString() {
16-
result = any(Ruby::Comment c | this = RubyComment(c)).toString()
20+
result = this.asRubyComment().toString()
1721
or
18-
result = any(R::ErbComment c | this = ErbComment(c)).toString()
22+
result = this.asErbComment().toString()
1923
}
2024

2125
Location getLocation() {
22-
result = any(Ruby::Comment c | this = RubyComment(c)).getLocation()
26+
result = this.asRubyComment().getLocation()
2327
or
24-
result = any(R::ErbComment c | this = ErbComment(c)).getLocation()
28+
result = this.asErbComment().getLocation()
2529
}
2630

2731
string getContents() {
28-
result = any(Ruby::Comment c | this = RubyComment(c)).getValue().suffix(1)
32+
result = this.asRubyComment().getValue().suffix(1)
2933
or
30-
result = any(R::ErbComment c | this = ErbComment(c)).getValue().suffix(1)
34+
result = this.asErbComment().getValue().suffix(1)
3135
}
3236
}
3337

0 commit comments

Comments
 (0)