Add script flag to kotlin.Metadata
This will allow to distinguish compiled scripts from ordinary classes in the compiler, reflection, IDE, etc. #KT-13382 Fixed
This commit is contained in:
@@ -36,6 +36,7 @@ public final class JvmAnnotationNames {
|
||||
|
||||
public static final int METADATA_MULTIFILE_PARTS_INHERIT_FLAG = 1 << 0;
|
||||
public static final int METADATA_PRE_RELEASE_FLAG = 1 << 1;
|
||||
public static final int METADATA_SCRIPT_FLAG = 1 << 2;
|
||||
|
||||
public static final Name DEFAULT_ANNOTATION_MEMBER_NAME = Name.identifier("value");
|
||||
|
||||
|
||||
+3
@@ -71,5 +71,8 @@ class KotlinClassHeader(
|
||||
val isPreRelease: Boolean
|
||||
get() = (extraInt and JvmAnnotationNames.METADATA_PRE_RELEASE_FLAG) != 0
|
||||
|
||||
val isScript: Boolean
|
||||
get() = (extraInt and JvmAnnotationNames.METADATA_SCRIPT_FLAG) != 0
|
||||
|
||||
override fun toString() = "$kind version=$metadataVersion"
|
||||
}
|
||||
|
||||
@@ -61,6 +61,7 @@ internal annotation class Metadata(
|
||||
*
|
||||
* 0 - this is a multi-file class facade or part, compiled with `-Xmultifile-parts-inherit`.
|
||||
* 1 - this class file is compiled by a pre-release version of Kotlin and is not visible to release versions.
|
||||
* 2 - this class file is a compiled Kotlin script source file (.kts).
|
||||
*/
|
||||
val xi: Int = 0
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user