Java/Kotlin: Add File.is{,Java,Kotlin}SourceFile()

This commit is contained in:
Ian Lynagh
2021-12-08 15:40:29 +00:00
parent 70708d69bf
commit 7c03ed99dc
8 changed files with 21 additions and 12 deletions

View File

@@ -34,7 +34,7 @@ class Element extends @element, Top {
* Elements pertaining to source files may include generated elements
* not visible in source code, such as implicit default constructors.
*/
predicate fromSource() { this.getCompilationUnit().getExtension() = ["java", "kt"] }
predicate fromSource() { this.getCompilationUnit().isSourceFile() }
/** Gets the compilation unit that this element belongs to. */
CompilationUnit getCompilationUnit() { result = this.getFile() }