Serialize packages via descriptors in codegen

Disable KotlinPackage annotation for scripts, otherwise script analyzer tries
to add descriptors to a locked scope
This commit is contained in:
Alexander Udalov
2013-07-15 23:34:10 +04:00
parent d059a15bff
commit 196b829002
2 changed files with 19 additions and 25 deletions
@@ -379,6 +379,19 @@ public class DescriptorSerializer {
return builder;
}
@NotNull
public ProtoBuf.Package.Builder packageProto(@NotNull NamespaceDescriptor descriptor) {
ProtoBuf.Package.Builder builder = ProtoBuf.Package.newBuilder();
for (DeclarationDescriptor declaration : sort(descriptor.getMemberScope().getAllDescriptors())) {
if (declaration instanceof PropertyDescriptor || declaration instanceof FunctionDescriptor) {
builder.addMember(callableProto((CallableMemberDescriptor) declaration));
}
}
return builder;
}
@NotNull
private static ProtoBuf.Type.Argument.Projection projection(@NotNull Variance projectionKind) {
switch (projectionKind) {