FIC: remove isFun from IR proto as conversion should happen in psi2ir

This commit is contained in:
Mikhail Zarechenskiy
2020-01-17 08:52:39 +03:00
parent 8206cadce2
commit 27e104187f
16 changed files with 16 additions and 114 deletions
@@ -168,8 +168,7 @@ class Fir2IrDeclarationStorage(
isData = regularClass?.isData == true, isData = regularClass?.isData == true,
isExternal = regularClass?.isExternal == true, isExternal = regularClass?.isExternal == true,
isInline = regularClass?.isInline == true, isInline = regularClass?.isInline == true,
isExpect = regularClass?.isExpect == true, isExpect = regularClass?.isExpect == true
isFun = false // TODO
).apply { ).apply {
descriptor.bind(this) descriptor.bind(this)
if (setParent && regularClass != null) { if (setParent && regularClass != null) {
@@ -216,8 +215,8 @@ class Fir2IrDeclarationStorage(
startOffset, endOffset, origin, symbol, startOffset, endOffset, origin, symbol,
Name.special("<no name provided>"), anonymousObject.classKind, Name.special("<no name provided>"), anonymousObject.classKind,
Visibilities.LOCAL, modality, Visibilities.LOCAL, modality,
isCompanion = false, isInner = false, isData = false, isExternal = false, isCompanion = false, isInner = false, isData = false,
isInline = false, isExpect = false, isFun = false isExternal = false, isInline = false, isExpect = false
).apply { ).apply {
descriptor.bind(this) descriptor.bind(this)
declareThisReceiver() declareThisReceiver()
@@ -236,7 +235,8 @@ class Fir2IrDeclarationStorage(
startOffset, endOffset, origin, symbol, startOffset, endOffset, origin, symbol,
enumEntry.name, anonymousObject.classKind, enumEntry.name, anonymousObject.classKind,
Visibilities.LOCAL, modality, Visibilities.LOCAL, modality,
isCompanion = false, isInner = false, isData = false, isExternal = false, isInline = false, isExpect = false isCompanion = false, isInner = false, isData = false,
isExternal = false, isInline = false, isExpect = false
).apply { ).apply {
descriptor.bind(this) descriptor.bind(this)
declareThisReceiver() declareThisReceiver()
@@ -294,8 +294,7 @@ abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val co
isData = false, isData = false,
isExternal = false, isExternal = false,
isInline = false, isInline = false,
isExpect = false, isExpect = false
isFun = false
).apply { ).apply {
d.bind(this) d.bind(this)
parent = irFunction.parent parent = irFunction.parent
@@ -27,7 +27,7 @@ fun IrClassBuilder.buildClass(): IrClass {
IrClassSymbolImpl(wrappedDescriptor), IrClassSymbolImpl(wrappedDescriptor),
name, kind, visibility, modality, name, kind, visibility, modality,
isCompanion = isCompanion, isInner = isInner, isData = isData, isExternal = isExternal, isCompanion = isCompanion, isInner = isInner, isData = isData, isExternal = isExternal,
isInline = isInline, isExpect = isExpect, isFun = isFun isInline = isInline, isExpect = isExpect
).also { ).also {
wrappedDescriptor.bind(it) wrappedDescriptor.bind(it)
} }
@@ -127,7 +127,7 @@ class JsSharedVariablesManager(val builtIns: IrBuiltIns, val implicitDeclaration
UNDEFINED_OFFSET, UNDEFINED_OFFSET, JsLoweredDeclarationOrigin.JS_CLOSURE_BOX_CLASS_DECLARATION, IrClassSymbolImpl(descriptor), UNDEFINED_OFFSET, UNDEFINED_OFFSET, JsLoweredDeclarationOrigin.JS_CLOSURE_BOX_CLASS_DECLARATION, IrClassSymbolImpl(descriptor),
Name.identifier(boxTypeName), ClassKind.CLASS, Visibilities.PUBLIC, Modality.FINAL, Name.identifier(boxTypeName), ClassKind.CLASS, Visibilities.PUBLIC, Modality.FINAL,
isCompanion = false, isInner = false, isData = false, isExternal = false, isCompanion = false, isInner = false, isData = false, isExternal = false,
isInline = false, isExpect = false, isFun = false isInline = false, isExpect = false
) )
descriptor.bind(declaration) descriptor.bind(declaration)
@@ -236,8 +236,7 @@ class JvmDeclarationFactory(
isData = false, isData = false,
isExternal = false, isExternal = false,
isInline = false, isInline = false,
isExpect = false, isExpect = false
isFun = false
).apply { ).apply {
descriptor.bind(this) descriptor.bind(this)
parent = interfaceClass parent = interfaceClass
@@ -88,8 +88,7 @@ private class FileClassLowering(val context: JvmBackendContext) : FileLoweringPa
isData = false, isData = false,
isExternal = false, isExternal = false,
isInline = false, isInline = false,
isExpect = false, isExpect = false
isFun = false
).apply { ).apply {
descriptor.bind(this) descriptor.bind(this)
superTypes.add(context.irBuiltIns.anyType) superTypes.add(context.irBuiltIns.anyType)
@@ -32,6 +32,5 @@ class IrClassBuilder : IrDeclarationBuilder() {
isExternal = from.isExternal isExternal = from.isExternal
isInline = from.isInline isInline = from.isInline
isExpect = from.isExpect isExpect = from.isExpect
isFun = from.isFun
} }
} }
@@ -39,7 +39,6 @@ interface IrClass :
val isExternal: Boolean val isExternal: Boolean
val isInline: Boolean val isInline: Boolean
val isExpect: Boolean val isExpect: Boolean
val isFun: Boolean
val superTypes: MutableList<IrType> val superTypes: MutableList<IrType>
@@ -44,8 +44,7 @@ class IrClassImpl(
override val isData: Boolean, override val isData: Boolean,
override val isExternal: Boolean, override val isExternal: Boolean,
override val isInline: Boolean, override val isInline: Boolean,
override val isExpect: Boolean, override val isExpect: Boolean
override val isFun: Boolean
) : ) :
IrDeclarationBase(startOffset, endOffset, origin), IrDeclarationBase(startOffset, endOffset, origin),
IrClass { IrClass {
@@ -67,8 +66,7 @@ class IrClassImpl(
isData = symbol.descriptor.isData, isData = symbol.descriptor.isData,
isExternal = symbol.descriptor.isEffectivelyExternal(), isExternal = symbol.descriptor.isEffectivelyExternal(),
isInline = symbol.descriptor.isInline, isInline = symbol.descriptor.isInline,
isExpect = symbol.descriptor.isExpect, isExpect = symbol.descriptor.isExpect
isFun = symbol.descriptor.isFun
) )
init { init {
@@ -35,7 +35,6 @@ class IrLazyClass(
override val isExternal: Boolean, override val isExternal: Boolean,
override val isInline: Boolean, override val isInline: Boolean,
override val isExpect: Boolean, override val isExpect: Boolean,
override val isFun: Boolean,
stubGenerator: DeclarationStubGenerator, stubGenerator: DeclarationStubGenerator,
typeTranslator: TypeTranslator typeTranslator: TypeTranslator
) : ) :
@@ -60,7 +59,6 @@ class IrLazyClass(
isExternal = symbol.descriptor.isEffectivelyExternal(), isExternal = symbol.descriptor.isEffectivelyExternal(),
isInline = symbol.descriptor.isInline, isInline = symbol.descriptor.isInline,
isExpect = symbol.descriptor.isExpect, isExpect = symbol.descriptor.isExpect,
isFun = symbol.descriptor.isFun,
stubGenerator = stubGenerator, stubGenerator = stubGenerator,
typeTranslator = TypeTranslator typeTranslator = TypeTranslator
) )
@@ -595,7 +595,7 @@ open class WrappedClassDescriptor(
override fun isInline() = owner.isInline override fun isInline() = owner.isInline
override fun isFun() = owner.isFun override fun isFun() = TODO("not implemented")
override fun getThisAsReceiverParameter() = owner.thisReceiver?.descriptor as ReceiverParameterDescriptor override fun getThisAsReceiverParameter() = owner.thisReceiver?.descriptor as ReceiverParameterDescriptor
@@ -640,7 +640,7 @@ open class WrappedClassDescriptor(
} }
override fun getDefaultFunctionTypeForSamInterface(): SimpleType? { override fun getDefaultFunctionTypeForSamInterface(): SimpleType? {
return owner.descriptor.defaultFunctionTypeForSamInterface TODO("not implemented")
} }
override fun isDefinitelyNotSamInterface(): Boolean { override fun isDefinitelyNotSamInterface(): Boolean {
@@ -147,8 +147,7 @@ open class DeepCopyIrTreeWithSymbols(
declaration.isData, declaration.isData,
declaration.isExternal, declaration.isExternal,
declaration.isInline, declaration.isInline,
declaration.isExpect, declaration.isExpect
declaration.isFun
).apply { ).apply {
transformAnnotations(declaration) transformAnnotations(declaration)
copyTypeParametersFrom(declaration) copyTypeParametersFrom(declaration)
@@ -648,7 +648,6 @@ message IrClass {
required IrDeclarationContainer declaration_container = 13; required IrDeclarationContainer declaration_container = 13;
repeated int32 super_type = 14; repeated int32 super_type = 14;
required bool is_expect = 15; required bool is_expect = 15;
required bool is_fun = 16;
} }
message IrTypeAlias { message IrTypeAlias {
@@ -980,8 +980,7 @@ abstract class IrFileDeserializer(
isData = proto.isData, isData = proto.isData,
isExternal = proto.isExternal, isExternal = proto.isExternal,
isInline = proto.isInline, isInline = proto.isInline,
isExpect = proto.isExpect, isExpect = proto.isExpect
isFun = proto.isFun
) )
}.usingParent { }.usingParent {
proto.declarationContainer.declarationList.mapTo(declarations) { deserializeDeclaration(it) } proto.declarationContainer.declarationList.mapTo(declarations) { deserializeDeclaration(it) }
@@ -198,11 +198,6 @@ public final class IrClass extends
isExpect_ = input.readBool(); isExpect_ = input.readBool();
break; break;
} }
case 128: {
bitField0_ |= 0x00004000;
isFun_ = input.readBool();
break;
}
} }
} }
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -480,21 +475,6 @@ public final class IrClass extends
return isExpect_; return isExpect_;
} }
public static final int IS_FUN_FIELD_NUMBER = 16;
private boolean isFun_;
/**
* <code>required bool is_fun = 16;</code>
*/
public boolean hasIsFun() {
return ((bitField0_ & 0x00004000) == 0x00004000);
}
/**
* <code>required bool is_fun = 16;</code>
*/
public boolean getIsFun() {
return isFun_;
}
private void initFields() { private void initFields() {
base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase.getDefaultInstance(); base_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationBase.getDefaultInstance();
name_ = 0; name_ = 0;
@@ -511,7 +491,6 @@ public final class IrClass extends
declarationContainer_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer.getDefaultInstance(); declarationContainer_ = org.jetbrains.kotlin.backend.common.serialization.proto.IrDeclarationContainer.getDefaultInstance();
superType_ = java.util.Collections.emptyList(); superType_ = java.util.Collections.emptyList();
isExpect_ = false; isExpect_ = false;
isFun_ = false;
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
public final boolean isInitialized() { public final boolean isInitialized() {
@@ -571,10 +550,6 @@ public final class IrClass extends
memoizedIsInitialized = 0; memoizedIsInitialized = 0;
return false; return false;
} }
if (!hasIsFun()) {
memoizedIsInitialized = 0;
return false;
}
if (!getBase().isInitialized()) { if (!getBase().isInitialized()) {
memoizedIsInitialized = 0; memoizedIsInitialized = 0;
return false; return false;
@@ -649,9 +624,6 @@ public final class IrClass extends
if (((bitField0_ & 0x00002000) == 0x00002000)) { if (((bitField0_ & 0x00002000) == 0x00002000)) {
output.writeBool(15, isExpect_); output.writeBool(15, isExpect_);
} }
if (((bitField0_ & 0x00004000) == 0x00004000)) {
output.writeBool(16, isFun_);
}
output.writeRawBytes(unknownFields); output.writeRawBytes(unknownFields);
} }
@@ -726,10 +698,6 @@ public final class IrClass extends
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(15, isExpect_); .computeBoolSize(15, isExpect_);
} }
if (((bitField0_ & 0x00004000) == 0x00004000)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBoolSize(16, isFun_);
}
size += unknownFields.size(); size += unknownFields.size();
memoizedSerializedSize = size; memoizedSerializedSize = size;
return size; return size;
@@ -854,8 +822,6 @@ public final class IrClass extends
bitField0_ = (bitField0_ & ~0x00002000); bitField0_ = (bitField0_ & ~0x00002000);
isExpect_ = false; isExpect_ = false;
bitField0_ = (bitField0_ & ~0x00004000); bitField0_ = (bitField0_ & ~0x00004000);
isFun_ = false;
bitField0_ = (bitField0_ & ~0x00008000);
return this; return this;
} }
@@ -940,10 +906,6 @@ public final class IrClass extends
to_bitField0_ |= 0x00002000; to_bitField0_ |= 0x00002000;
} }
result.isExpect_ = isExpect_; result.isExpect_ = isExpect_;
if (((from_bitField0_ & 0x00008000) == 0x00008000)) {
to_bitField0_ |= 0x00004000;
}
result.isFun_ = isFun_;
result.bitField0_ = to_bitField0_; result.bitField0_ = to_bitField0_;
return result; return result;
} }
@@ -1002,9 +964,6 @@ public final class IrClass extends
if (other.hasIsExpect()) { if (other.hasIsExpect()) {
setIsExpect(other.getIsExpect()); setIsExpect(other.getIsExpect());
} }
if (other.hasIsFun()) {
setIsFun(other.getIsFun());
}
setUnknownFields( setUnknownFields(
getUnknownFields().concat(other.unknownFields)); getUnknownFields().concat(other.unknownFields));
return this; return this;
@@ -1063,10 +1022,6 @@ public final class IrClass extends
return false; return false;
} }
if (!hasIsFun()) {
return false;
}
if (!getBase().isInitialized()) { if (!getBase().isInitialized()) {
return false; return false;
@@ -1787,38 +1742,6 @@ public final class IrClass extends
return this; return this;
} }
private boolean isFun_ ;
/**
* <code>required bool is_fun = 16;</code>
*/
public boolean hasIsFun() {
return ((bitField0_ & 0x00008000) == 0x00008000);
}
/**
* <code>required bool is_fun = 16;</code>
*/
public boolean getIsFun() {
return isFun_;
}
/**
* <code>required bool is_fun = 16;</code>
*/
public Builder setIsFun(boolean value) {
bitField0_ |= 0x00008000;
isFun_ = value;
return this;
}
/**
* <code>required bool is_fun = 16;</code>
*/
public Builder clearIsFun() {
bitField0_ = (bitField0_ & ~0x00008000);
isFun_ = false;
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrClass) // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.backend.common.serialization.proto.IrClass)
} }
@@ -153,13 +153,4 @@ public interface IrClassOrBuilder extends
* <code>required bool is_expect = 15;</code> * <code>required bool is_expect = 15;</code>
*/ */
boolean getIsExpect(); boolean getIsExpect();
/**
* <code>required bool is_fun = 16;</code>
*/
boolean hasIsFun();
/**
* <code>required bool is_fun = 16;</code>
*/
boolean getIsFun();
} }