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:
Alexander Udalov
2017-01-09 12:21:59 +03:00
parent 7c6d5c825c
commit e860d620c6
6 changed files with 20 additions and 11 deletions
@@ -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");
@@ -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"
}