KT-12877: initial simple implementation of JsModule. Remove unnecessary ModuleDescriptor from several classes in pipeline
This commit is contained in:
committed by
Alexey Andreev
parent
75d80acac9
commit
6df40559f0
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
|
||||
public final class AnnotationsUtils {
|
||||
private static final String JS_NAME = "kotlin.js.JsName";
|
||||
private static final FqName JS_MODULE_ANNOTATION = new FqName("kotlin.js.JsModule");
|
||||
|
||||
private AnnotationsUtils() {
|
||||
}
|
||||
@@ -169,4 +170,14 @@ public final class AnnotationsUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getModuleName(@NotNull DeclarationDescriptor declaration) {
|
||||
AnnotationDescriptor annotation = declaration.getAnnotations().findAnnotation(JS_MODULE_ANNOTATION);
|
||||
if (annotation == null) return null;
|
||||
|
||||
ConstantValue<?> importValue = annotation.getAllValueArguments().values().iterator().next();
|
||||
assert importValue != null : "JsModule annotation should have at least one argument";
|
||||
return (String) importValue.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user