DescriptorFinder now can find class names in a package

This helps to get rid of "repeated class_name" field in Package protobuf
message. DescriptorFinder in resolve.java uses PSI to find all classes in a
package, and the finder for built-ins just reads .kotlin_class_names file
This commit is contained in:
Alexander Udalov
2013-07-15 22:54:55 +04:00
parent 047ed18901
commit b602db03f2
12 changed files with 114 additions and 191 deletions
@@ -150,19 +150,14 @@ public class NamespaceCodegen extends MemberCodegen {
ProtoBuf.Callable proto = serializer.callableProto((CallableMemberDescriptor) descriptor).build();
packageProto.addMember(proto);
}
else if (declaration instanceof JetClassOrObject) {
DeclarationDescriptor descriptor = getNotNull(state.getBindingContext(), DECLARATION_TO_DESCRIPTOR, declaration);
if (declaration instanceof JetObjectDeclaration) {
writeAnnotation = true;
JetObjectDeclarationName nameAsDeclaration = ((JetObjectDeclaration) declaration).getNameAsDeclaration();
assert nameAsDeclaration != null : "Should be a named object";
PropertyDescriptor propertyForObject = getNotNull(state.getBindingContext(), BindingContext.OBJECT_DECLARATION,
nameAsDeclaration);
ProtoBuf.Callable proto = serializer.callableProto(propertyForObject).build();
packageProto.addMember(proto);
}
int name = serializer.getNameTable().getSimpleNameIndex(descriptor.getName());
packageProto.addClassName(name);
else if (declaration instanceof JetObjectDeclaration) {
writeAnnotation = true;
JetObjectDeclarationName nameAsDeclaration = ((JetObjectDeclaration) declaration).getNameAsDeclaration();
assert nameAsDeclaration != null : "Should be a named object";
PropertyDescriptor propertyForObject = getNotNull(state.getBindingContext(), BindingContext.OBJECT_DECLARATION,
nameAsDeclaration);
ProtoBuf.Callable proto = serializer.callableProto(propertyForObject).build();
packageProto.addMember(proto);
}
}
}