KJS: type -> kind
This commit is contained in:
@@ -111,6 +111,12 @@ public final class Namer {
|
||||
public static final String LOCAL_MODULE_PREFIX = "$module$";
|
||||
public static final String METADATA = "$metadata$";
|
||||
public static final String METADATA_SUPERTYPES = "baseClasses";
|
||||
public static final String METADATA_SIMPLE_NAME = "simpleName";
|
||||
public static final String METADATA_CLASS_KIND = "kind";
|
||||
public static final String CLASS_KIND_ENUM = "Kind";
|
||||
public static final String CLASS_KIND_CLASS = "CLASS";
|
||||
public static final String CLASS_KIND_INTERFACE = "INTERFACE";
|
||||
public static final String CLASS_KIND_OBJECT = "OBJECT";
|
||||
|
||||
public static final String OBJECT_INSTANCE_VAR_SUFFIX = "_instance";
|
||||
public static final String OBJECT_INSTANCE_FUNCTION_SUFFIX = "_getInstance";
|
||||
|
||||
+6
-6
@@ -171,18 +171,18 @@ class ClassTranslator private constructor(
|
||||
private fun createMetadataRef() = JsNameRef(Namer.METADATA, context().getInnerReference(descriptor))
|
||||
|
||||
private fun addMetadataType() {
|
||||
val kotlinType = JsNameRef("TYPE", Namer.KOTLIN_NAME)
|
||||
val kotlinType = JsNameRef(Namer.CLASS_KIND_ENUM, Namer.KOTLIN_NAME)
|
||||
val typeRef = when {
|
||||
DescriptorUtils.isInterface(descriptor) -> JsNameRef("INTERFACE", kotlinType)
|
||||
DescriptorUtils.isObject(descriptor) -> JsNameRef("OBJECT", kotlinType)
|
||||
else -> JsNameRef("CLASS", kotlinType)
|
||||
DescriptorUtils.isInterface(descriptor) -> JsNameRef(Namer.CLASS_KIND_INTERFACE, kotlinType)
|
||||
DescriptorUtils.isObject(descriptor) -> JsNameRef(Namer.CLASS_KIND_OBJECT, kotlinType)
|
||||
else -> JsNameRef(Namer.CLASS_KIND_CLASS, kotlinType)
|
||||
}
|
||||
|
||||
metadataLiteral.propertyInitializers += JsPropertyInitializer(JsNameRef("type"), typeRef)
|
||||
metadataLiteral.propertyInitializers += JsPropertyInitializer(JsNameRef(Namer.METADATA_CLASS_KIND), typeRef)
|
||||
|
||||
val simpleName = descriptor.name
|
||||
if (!simpleName.isSpecial) {
|
||||
val simpleNameProp = JsPropertyInitializer(JsNameRef("simpleName"), program().getStringLiteral(simpleName.identifier))
|
||||
val simpleNameProp = JsPropertyInitializer(JsNameRef(Namer.METADATA_SIMPLE_NAME), program().getStringLiteral(simpleName.identifier))
|
||||
metadataLiteral.propertyInitializers += simpleNameProp
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user