mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
Revert "Merge pull request #37 from erik-krogh/shared/inline-tests"
This reverts commit65fe9abcfe, reversing changes made to08e9d3391f.
This commit is contained in:
@@ -6,35 +6,37 @@
|
||||
private import java as J
|
||||
private import codeql.util.test.InlineExpectationsTest
|
||||
|
||||
/**
|
||||
* A class representing line comments in Java, which is simply Javadoc restricted
|
||||
* to EOL comments, with an extra accessor used by the InlineExpectations core code
|
||||
*/
|
||||
abstract private class ExpectationComment extends J::Top {
|
||||
/** Gets the contents of the given comment, _without_ the preceding comment marker (`//`). */
|
||||
abstract string getContents();
|
||||
}
|
||||
|
||||
private class JavadocExpectationComment extends J::Javadoc, ExpectationComment {
|
||||
JavadocExpectationComment() { isEolComment(this) }
|
||||
|
||||
override string getContents() { result = this.getChild(0).toString() }
|
||||
}
|
||||
|
||||
private class KtExpectationComment extends J::KtComment, ExpectationComment {
|
||||
KtExpectationComment() { this.isEolComment() }
|
||||
|
||||
override string getContents() { result = this.getText().suffix(2).trim() }
|
||||
}
|
||||
|
||||
private class XmlExpectationComment extends ExpectationComment instanceof J::XmlComment {
|
||||
override string getContents() { result = super.getText().trim() }
|
||||
|
||||
override predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
|
||||
J::XmlComment.super.hasLocationInfo(path, sl, sc, el, ec)
|
||||
private module Impl implements InlineExpectationsTestSig {
|
||||
/**
|
||||
* A class representing line comments in Java, which is simply Javadoc restricted
|
||||
* to EOL comments, with an extra accessor used by the InlineExpectations core code
|
||||
*/
|
||||
abstract class ExpectationComment extends J::Top {
|
||||
/** Gets the contents of the given comment, _without_ the preceding comment marker (`//`). */
|
||||
abstract string getContents();
|
||||
}
|
||||
|
||||
override string toString() { result = J::XmlComment.super.toString() }
|
||||
private class JavadocExpectationComment extends J::Javadoc, ExpectationComment {
|
||||
JavadocExpectationComment() { isEolComment(this) }
|
||||
|
||||
override string getContents() { result = this.getChild(0).toString() }
|
||||
}
|
||||
|
||||
private class KtExpectationComment extends J::KtComment, ExpectationComment {
|
||||
KtExpectationComment() { this.isEolComment() }
|
||||
|
||||
override string getContents() { result = this.getText().suffix(2).trim() }
|
||||
}
|
||||
|
||||
private class XmlExpectationComment extends ExpectationComment instanceof J::XmlComment {
|
||||
override string getContents() { result = super.getText().trim() }
|
||||
|
||||
override Location getLocation() { result = J::XmlComment.super.getLocation() }
|
||||
|
||||
override string toString() { result = J::XmlComment.super.toString() }
|
||||
}
|
||||
|
||||
class Location = J::Location;
|
||||
}
|
||||
|
||||
import Make<ExpectationComment>
|
||||
import Make<Impl>
|
||||
|
||||
Reference in New Issue
Block a user