fix wrong names
This commit is contained in:
@@ -6,6 +6,7 @@ import org.jetbrains.jet.lang.descriptors.*;
|
|||||||
import org.jetbrains.jet.lang.psi.*;
|
import org.jetbrains.jet.lang.psi.*;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||||
|
import org.jetbrains.jet.lang.resolve.StdlibNames;
|
||||||
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
|
||||||
import org.jetbrains.jet.lang.types.JetType;
|
import org.jetbrains.jet.lang.types.JetType;
|
||||||
import org.objectweb.asm.AnnotationVisitor;
|
import org.objectweb.asm.AnnotationVisitor;
|
||||||
@@ -81,40 +82,40 @@ public class FunctionCodegen {
|
|||||||
if(v.generateCode()) {
|
if(v.generateCode()) {
|
||||||
int start = 0;
|
int start = 0;
|
||||||
if(kind != OwnerKind.TRAIT_IMPL) {
|
if(kind != OwnerKind.TRAIT_IMPL) {
|
||||||
AnnotationVisitor av = mv.visitAnnotation("Ljet/typeinfo/JetMethod;", true);
|
AnnotationVisitor av = mv.visitAnnotation(StdlibNames.JET_METHOD_TYPE.getDescriptor(), true);
|
||||||
if(functionDescriptor.getReturnType().isNullable()) {
|
if(functionDescriptor.getReturnType().isNullable()) {
|
||||||
av.visit("nullableReturnType", true);
|
av.visit(StdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD, true);
|
||||||
}
|
}
|
||||||
av.visitEnd();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(kind == OwnerKind.TRAIT_IMPL) {
|
if(kind == OwnerKind.TRAIT_IMPL) {
|
||||||
AnnotationVisitor av = mv.visitParameterAnnotation(start++, "Ljet/typeinfo/JetParameter;", true);
|
AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_PARAMETER_DESCRIPTOR, true);
|
||||||
av.visit("value", "this$self");
|
av.visit(StdlibNames.JET_PARAMETER_NAME_FIELD, "this$self");
|
||||||
av.visitEnd();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
if(receiverParameter.exists()) {
|
if(receiverParameter.exists()) {
|
||||||
AnnotationVisitor av = mv.visitParameterAnnotation(start++, "Ljet/typeinfo/JetParameter;", true);
|
AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_PARAMETER_DESCRIPTOR, true);
|
||||||
av.visit("value", "this$receiver");
|
av.visit(StdlibNames.JET_PARAMETER_NAME_FIELD, "this$receiver");
|
||||||
if(receiverParameter.getType().isNullable()) {
|
if(receiverParameter.getType().isNullable()) {
|
||||||
av.visit("nullable", true);
|
av.visit(StdlibNames.JET_PARAMETER_NULLABLE_FIELD, true);
|
||||||
}
|
}
|
||||||
av.visitEnd();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
for (final TypeParameterDescriptor typeParameterDescriptor : typeParameters) {
|
for (final TypeParameterDescriptor typeParameterDescriptor : typeParameters) {
|
||||||
AnnotationVisitor av = mv.visitParameterAnnotation(start++, "Ljet/typeinfo/JetTypeParameter;", true);
|
AnnotationVisitor av = mv.visitParameterAnnotation(start++, StdlibNames.JET_TYPE_PARAMETER_DESCRIPTOR, true);
|
||||||
av.visit("value", typeParameterDescriptor.getName());
|
av.visit(StdlibNames.JET_TYPE_PARAMETER_NAME_FIELD, typeParameterDescriptor.getName());
|
||||||
av.visitEnd();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
for(int i = 0; i != paramDescrs.size(); ++i) {
|
for(int i = 0; i != paramDescrs.size(); ++i) {
|
||||||
AnnotationVisitor av = mv.visitParameterAnnotation(i + start, "Ljet/typeinfo/JetParameter;", true);
|
AnnotationVisitor av = mv.visitParameterAnnotation(i + start, StdlibNames.JET_PARAMETER_DESCRIPTOR, true);
|
||||||
ValueParameterDescriptor parameterDescriptor = paramDescrs.get(i);
|
ValueParameterDescriptor parameterDescriptor = paramDescrs.get(i);
|
||||||
av.visit("name", parameterDescriptor.getName());
|
av.visit(StdlibNames.JET_PARAMETER_NAME_FIELD, parameterDescriptor.getName());
|
||||||
if(parameterDescriptor.hasDefaultValue()) {
|
if(parameterDescriptor.hasDefaultValue()) {
|
||||||
av.visit("hasDefaultValue", true);
|
av.visit(StdlibNames.JET_PARAMETER_HAS_DEFAULT_FIELD, true);
|
||||||
}
|
}
|
||||||
if(parameterDescriptor.getOutType().isNullable()) {
|
if(parameterDescriptor.getOutType().isNullable()) {
|
||||||
av.visit("nullable", true);
|
av.visit(StdlibNames.JET_PARAMETER_NULLABLE_FIELD, true);
|
||||||
}
|
}
|
||||||
av.visitEnd();
|
av.visitEnd();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ public class JetTypeMapper {
|
|||||||
public static final Type TYPE_FLOAT_ITERATOR = Type.getObjectType("jet/FloatIterator");
|
public static final Type TYPE_FLOAT_ITERATOR = Type.getObjectType("jet/FloatIterator");
|
||||||
public static final Type TYPE_DOUBLE_ITERATOR = Type.getObjectType("jet/DoubleIterator");
|
public static final Type TYPE_DOUBLE_ITERATOR = Type.getObjectType("jet/DoubleIterator");
|
||||||
|
|
||||||
|
public static final Type TYPE_JET_PARAMETER = Type.getType(JetParameter.class);
|
||||||
|
|
||||||
public JetTypeMapper(JetStandardLibrary standardLibrary, BindingContext bindingContext) {
|
public JetTypeMapper(JetStandardLibrary standardLibrary, BindingContext bindingContext) {
|
||||||
this.standardLibrary = standardLibrary;
|
this.standardLibrary = standardLibrary;
|
||||||
this.bindingContext = bindingContext;
|
this.bindingContext = bindingContext;
|
||||||
|
|||||||
+6
-5
@@ -14,6 +14,7 @@ import org.jetbrains.jet.lang.descriptors.*;
|
|||||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||||
|
import org.jetbrains.jet.lang.resolve.StdlibNames;
|
||||||
import org.jetbrains.jet.lang.types.*;
|
import org.jetbrains.jet.lang.types.*;
|
||||||
import org.jetbrains.jet.plugin.JetFileType;
|
import org.jetbrains.jet.plugin.JetFileType;
|
||||||
|
|
||||||
@@ -354,13 +355,13 @@ public class JavaDescriptorResolver {
|
|||||||
PsiNameValuePair[] attributes = annotation.getParameterList().getAttributes();
|
PsiNameValuePair[] attributes = annotation.getParameterList().getAttributes();
|
||||||
attributes.toString();
|
attributes.toString();
|
||||||
|
|
||||||
if (annotation.getQualifiedName().equals("jet.typeinfo.JetParameter")) {
|
if (annotation.getQualifiedName().equals(StdlibNames.JET_PARAMETER_CLASS)) {
|
||||||
PsiLiteralExpression nameExpression = (PsiLiteralExpression) annotation.findAttributeValue("name");
|
PsiLiteralExpression nameExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_PARAMETER_NAME_FIELD);
|
||||||
if (nameExpression != null) {
|
if (nameExpression != null) {
|
||||||
name = (String) nameExpression.getValue();
|
name = (String) nameExpression.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue("nullable");
|
PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_PARAMETER_NULLABLE_FIELD);
|
||||||
if (nullableExpression != null) {
|
if (nullableExpression != null) {
|
||||||
nullable = (Boolean) nullableExpression.getValue();
|
nullable = (Boolean) nullableExpression.getValue();
|
||||||
} else {
|
} else {
|
||||||
@@ -496,8 +497,8 @@ public class JavaDescriptorResolver {
|
|||||||
boolean nullable = true;
|
boolean nullable = true;
|
||||||
|
|
||||||
for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) {
|
for (PsiAnnotation annotation : method.getModifierList().getAnnotations()) {
|
||||||
if (annotation.getQualifiedName().equals("jet.typeinfo.JetMethod")) {
|
if (annotation.getQualifiedName().equals(StdlibNames.JET_METHOD_CLASS)) {
|
||||||
PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue("nullableReturnType");
|
PsiLiteralExpression nullableExpression = (PsiLiteralExpression) annotation.findAttributeValue(StdlibNames.JET_METHOD_NULLABLE_RETURN_TYPE_FIELD);
|
||||||
if (nullableExpression != null) {
|
if (nullableExpression != null) {
|
||||||
nullable = (Boolean) nullableExpression.getValue();
|
nullable = (Boolean) nullableExpression.getValue();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package org.jetbrains.jet.lang.resolve;
|
||||||
|
|
||||||
|
import org.objectweb.asm.Type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Stepan Koltsov
|
||||||
|
*/
|
||||||
|
public class StdlibNames {
|
||||||
|
|
||||||
|
public static final Type JET_PARAMETER_TYPE = Type.getObjectType("jet/typeinfo/JetParameter");
|
||||||
|
public static final String JET_PARAMETER_CLASS = "jet.typeinfo.JetParameter";
|
||||||
|
public static final String JET_PARAMETER_DESCRIPTOR = "Ljet/typeinfo/JetParameter;";
|
||||||
|
|
||||||
|
public static final String JET_PARAMETER_NAME_FIELD = "name";
|
||||||
|
public static final String JET_PARAMETER_HAS_DEFAULT_FIELD = "hasDefault";
|
||||||
|
public static final String JET_PARAMETER_NULLABLE_FIELD = "nullable";
|
||||||
|
|
||||||
|
|
||||||
|
public static final Type JET_TYPE_PARAMETER_TYPE = Type.getObjectType("jet/typeinfo/JetTypeParameter");
|
||||||
|
public static final String JET_TYPE_PARAMETER_CLASS = "jet.typeinfo.JetTypeParameter";
|
||||||
|
public static final String JET_TYPE_PARAMETER_DESCRIPTOR = "Ljet/typeinfo/JetTypeParameter;";
|
||||||
|
|
||||||
|
public static final String JET_TYPE_PARAMETER_NAME_FIELD = "name";
|
||||||
|
|
||||||
|
|
||||||
|
public static final Type JET_METHOD_TYPE = Type.getObjectType("jet/typeinfo/JetMethod");
|
||||||
|
public static final String JET_METHOD_CLASS = "jet.typeinfo.JetMethod";
|
||||||
|
public static final String JET_METHOD_DESCRIPTOR = "Ljet/typeinfo/JetMethod;";
|
||||||
|
|
||||||
|
public static final String JET_METHOD_NULLABLE_RETURN_TYPE_FIELD = "nullableReturnType";
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user