rename annotations to native and library

This commit is contained in:
Pavel Talanov
2012-02-03 16:20:20 +04:00
parent bcbba26d68
commit 566eb09139
2 changed files with 8 additions and 10 deletions
@@ -185,14 +185,14 @@ public class StaticContext {
public JsName apply(@NotNull DeclarationDescriptor descriptor) {
//TODO: refactor
String name = null;
AnnotationDescriptor annotation = getAnnotationByName(descriptor, LIBRARY_FUNCTION_ANNOTATION_FQNAME);
AnnotationDescriptor annotation = getAnnotationByName(descriptor, LIBRARY_ANNOTATION_FQNAME);
if (annotation != null) {
name = AnnotationsUtils.getAnnotationStringParameter(descriptor, LIBRARY_FUNCTION_ANNOTATION_FQNAME);
name = AnnotationsUtils.getAnnotationStringParameter(descriptor, LIBRARY_ANNOTATION_FQNAME);
name = (!name.isEmpty()) ? name : descriptor.getName();
} else {
ClassDescriptor containingClass = getContainingClass(descriptor);
if (containingClass == null) return null;
if (getAnnotationByName(containingClass, LIBRARY_CLASS_ANNOTATION_FQNAME) != null) {
if (getAnnotationByName(containingClass, LIBRARY_ANNOTATION_FQNAME) != null) {
name = descriptor.getName();
}
}
@@ -334,10 +334,10 @@ public class StaticContext {
//TODO: refactor by removing one annotation
@Override
public JsNameRef apply(@NotNull DeclarationDescriptor descriptor) {
if (getAnnotationByName(descriptor, AnnotationsUtils.LIBRARY_FUNCTION_ANNOTATION_FQNAME) != null) {
if (getAnnotationByName(descriptor, AnnotationsUtils.LIBRARY_ANNOTATION_FQNAME) != null) {
return namer.kotlinObject();
}
if (getAnnotationByName(descriptor, AnnotationsUtils.LIBRARY_CLASS_ANNOTATION_FQNAME) != null) {
if (getAnnotationByName(descriptor, AnnotationsUtils.LIBRARY_ANNOTATION_FQNAME) != null) {
return namer.kotlinObject();
}
return null;
@@ -350,7 +350,7 @@ public class StaticContext {
if (containingClass == null) {
return null;
}
if (getAnnotationByName(descriptor, LIBRARY_CLASS_ANNOTATION_FQNAME) != null) {
if (getAnnotationByName(descriptor, LIBRARY_ANNOTATION_FQNAME) != null) {
return namer.kotlinObject();
}
return null;
@@ -16,11 +16,9 @@ import static org.jetbrains.k2js.translate.utils.DescriptorUtils.getContainingCl
public final class AnnotationsUtils {
@NotNull
public static final String NATIVE_ANNOTATION_FQNAME = "js.annotations.Native";
public static final String NATIVE_ANNOTATION_FQNAME = "js.annotations.native";
@NotNull
public static final String LIBRARY_FUNCTION_ANNOTATION_FQNAME = "js.annotations.LibraryFun";
@NotNull
public static final String LIBRARY_CLASS_ANNOTATION_FQNAME = "js.annotations.LibraryClass";
public static final String LIBRARY_ANNOTATION_FQNAME = "js.annotations.library";
private AnnotationsUtils() {
}