SourceLocation
@UiToolingDataApi
data class SourceLocation
Source location of the call that produced the call group.
Summary
Public constructors |
|---|
Public properties |
|
|---|---|
Int |
The length of the source code. |
Int |
A 0 offset line number of the source location. |
Int |
Offset into the file. |
Int |
A hash code of the package name of the file. |
String? |
The file name (without path information) of the source file that contains the call that produced the group. |
Public constructors
Public properties
length
val length: Int
The length of the source code. The length is calculated as the number of UTF-16 code units that that make up the call expression.
offset
val offset: Int
Offset into the file. The offset is calculated as the number of UTF-16 code units from the beginning of the file to the first UTF-16 code unit of the call that produced the group.
packageHash
val packageHash: Int
A hash code of the package name of the file. This hash is calculated by,
packageName.fold(0) { hash, current -> hash * 31 + current.toInt() }?.absoluteValue
where the package name is the dotted name of the package. This can be used to disambiguate which file is referenced by sourceFile. This number is -1 if there was no package hash information generated such as when the file does not contain a package declaration.
sourceFile
val sourceFile: String?
The file name (without path information) of the source file that contains the call that produced the group. A source file names are not guaranteed to be unique, packageHash is included to help disambiguate files with duplicate names.