Kotlin: Fix File locations, and fromSource/hasSourceLocation for Kotlin code

This commit is contained in:
Ian Lynagh
2021-10-21 20:52:15 +01:00
parent b9359bd119
commit 14a10564f3
6 changed files with 10 additions and 5 deletions

View File

@@ -192,7 +192,7 @@ class Location extends @location {
}
private predicate hasSourceLocation(Top l, Location loc, File f) {
hasLocation(l, loc) and f = loc.getFile() and f.getExtension() = "java"
hasLocation(l, loc) and f = loc.getFile() and f.getExtension() = ["java", "kt"]
}
cached

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" }
predicate fromSource() { this.getCompilationUnit().getExtension() = ["java", "kt"] }
/** Gets the compilation unit that this element belongs to. */
CompilationUnit getCompilationUnit() { result = this.getFile() }