Granular type information for properties

This commit is contained in:
Andrey Breslav
2011-03-24 15:38:19 +03:00
parent 090b843eb0
commit 1c6dc190ff
@@ -16,8 +16,27 @@ public class DescriptorUtil {
new DeclarationDescriptorVisitor<Void, StringBuilder>() {
@Override
public Void visitPropertyDescriptor(PropertyDescriptor descriptor, StringBuilder builder) {
JetType type = descriptor.getOutType();
builder.append(renderName(descriptor)).append(" : ").append(type);
JetType outType = descriptor.getOutType();
JetType inType = descriptor.getInType();
String typeString = "<no type>";
if (inType != null && outType != null) {
builder.append("var ");
if (inType.equals(outType)) {
typeString = outType.toString();
}
else {
typeString = "<in " + inType + " out " + outType + ">";
}
}
else if (outType != null) {
builder.append("val ");
typeString = outType.toString();
}
else if (inType != null) {
builder.append("<write-only> ");
typeString = inType.toString();
}
builder.append(renderName(descriptor)).append(" : ").append(typeString);
return super.visitPropertyDescriptor(descriptor, builder);
}