Rename isHeader to isExpect in descriptors
This commit is contained in:
committed by
Mikhail Glukhikh
parent
fd6eab38e5
commit
c8ee424f67
+1
-1
@@ -296,7 +296,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
|
|||||||
source: SourceElement
|
source: SourceElement
|
||||||
) : SyntheticJavaPropertyDescriptor, PropertyDescriptorImpl(
|
) : SyntheticJavaPropertyDescriptor, PropertyDescriptorImpl(
|
||||||
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
|
||||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false,
|
/* lateInit = */ false, /* isConst = */ false, /* isExpect = */ false, /* isImpl = */ false, /* isExternal = */ false,
|
||||||
/* isDelegated = */ false
|
/* isDelegated = */ false
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|||||||
@@ -645,7 +645,7 @@ class ControlFlowInformationProvider private constructor(
|
|||||||
is KtPrimaryConstructor -> if (!element.hasValOrVar()) {
|
is KtPrimaryConstructor -> if (!element.hasValOrVar()) {
|
||||||
val containingClass = owner.getContainingClassOrObject()
|
val containingClass = owner.getContainingClassOrObject()
|
||||||
val containingClassDescriptor = trace.get(DECLARATION_TO_DESCRIPTOR, containingClass) as? ClassDescriptor
|
val containingClassDescriptor = trace.get(DECLARATION_TO_DESCRIPTOR, containingClass) as? ClassDescriptor
|
||||||
if (!DescriptorUtils.isAnnotationClass(containingClassDescriptor) && containingClassDescriptor?.isHeader == false &&
|
if (!DescriptorUtils.isAnnotationClass(containingClassDescriptor) && containingClassDescriptor?.isExpect == false &&
|
||||||
!containingClassDescriptor.isEffectivelyExternal()
|
!containingClassDescriptor.isEffectivelyExternal()
|
||||||
) {
|
) {
|
||||||
report(UNUSED_PARAMETER.on(element, variableDescriptor), ctxt)
|
report(UNUSED_PARAMETER.on(element, variableDescriptor), ctxt)
|
||||||
@@ -665,7 +665,7 @@ class ControlFlowInformationProvider private constructor(
|
|||||||
if (isMain
|
if (isMain
|
||||||
|| functionDescriptor.isOverridableOrOverrides
|
|| functionDescriptor.isOverridableOrOverrides
|
||||||
|| owner.hasModifier(KtTokens.OVERRIDE_KEYWORD)
|
|| owner.hasModifier(KtTokens.OVERRIDE_KEYWORD)
|
||||||
|| functionDescriptor.isHeader || functionDescriptor.isImpl
|
|| functionDescriptor.isExpect || functionDescriptor.isImpl
|
||||||
|| functionDescriptor.isEffectivelyExternal()
|
|| functionDescriptor.isEffectivelyExternal()
|
||||||
|| OperatorNameConventions.GET_VALUE == functionName
|
|| OperatorNameConventions.GET_VALUE == functionName
|
||||||
|| OperatorNameConventions.SET_VALUE == functionName
|
|| OperatorNameConventions.SET_VALUE == functionName
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ class SyntheticClassOrObjectDescriptor(
|
|||||||
override fun isCompanionObject() = isCompanionObject
|
override fun isCompanionObject() = isCompanionObject
|
||||||
override fun isInner() = false
|
override fun isInner() = false
|
||||||
override fun isData() = false
|
override fun isData() = false
|
||||||
override fun isHeader() = false
|
override fun isExpect() = false
|
||||||
override fun isImpl() = false
|
override fun isImpl() = false
|
||||||
|
|
||||||
override fun getCompanionObjectDescriptor() = null
|
override fun getCompanionObjectDescriptor() = null
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class BodyResolver {
|
|||||||
@NotNull KtSecondaryConstructor constructor,
|
@NotNull KtSecondaryConstructor constructor,
|
||||||
@NotNull ClassConstructorDescriptor descriptor
|
@NotNull ClassConstructorDescriptor descriptor
|
||||||
) {
|
) {
|
||||||
if (descriptor.isHeader() || isEffectivelyExternal(descriptor)) {
|
if (descriptor.isExpect() || isEffectivelyExternal(descriptor)) {
|
||||||
// For header and external classes, we do not resolve constructor delegation calls because they are prohibited
|
// For header and external classes, we do not resolve constructor delegation calls because they are prohibited
|
||||||
return DataFlowInfo.Companion.getEMPTY();
|
return DataFlowInfo.Companion.getEMPTY();
|
||||||
}
|
}
|
||||||
@@ -367,7 +367,7 @@ public class BodyResolver {
|
|||||||
descriptor.getUnsubstitutedPrimaryConstructor() != null &&
|
descriptor.getUnsubstitutedPrimaryConstructor() != null &&
|
||||||
superClass.getKind() != ClassKind.INTERFACE &&
|
superClass.getKind() != ClassKind.INTERFACE &&
|
||||||
!superClass.getConstructors().isEmpty() &&
|
!superClass.getConstructors().isEmpty() &&
|
||||||
!descriptor.isHeader() && !isEffectivelyExternal(descriptor) &&
|
!descriptor.isExpect() && !isEffectivelyExternal(descriptor) &&
|
||||||
!ErrorUtils.isError(superClass)
|
!ErrorUtils.isError(superClass)
|
||||||
) {
|
) {
|
||||||
trace.report(SUPERTYPE_NOT_INITIALIZED.on(specifier));
|
trace.report(SUPERTYPE_NOT_INITIALIZED.on(specifier));
|
||||||
@@ -428,7 +428,7 @@ public class BodyResolver {
|
|||||||
assert enumEntryDescriptor.getKind() == ClassKind.ENUM_ENTRY : "Enum entry expected: " + enumEntryDescriptor;
|
assert enumEntryDescriptor.getKind() == ClassKind.ENUM_ENTRY : "Enum entry expected: " + enumEntryDescriptor;
|
||||||
ClassDescriptor enumClassDescriptor = (ClassDescriptor) enumEntryDescriptor.getContainingDeclaration();
|
ClassDescriptor enumClassDescriptor = (ClassDescriptor) enumEntryDescriptor.getContainingDeclaration();
|
||||||
if (enumClassDescriptor.getKind() != ClassKind.ENUM_CLASS) return;
|
if (enumClassDescriptor.getKind() != ClassKind.ENUM_CLASS) return;
|
||||||
if (enumClassDescriptor.isHeader()) return;
|
if (enumClassDescriptor.isExpect()) return;
|
||||||
|
|
||||||
List<ClassConstructorDescriptor> applicableConstructors = DescriptorUtilsKt.getConstructorForEmptyArgumentsList(enumClassDescriptor);
|
List<ClassConstructorDescriptor> applicableConstructors = DescriptorUtilsKt.getConstructorForEmptyArgumentsList(enumClassDescriptor);
|
||||||
if (applicableConstructors.size() != 1) {
|
if (applicableConstructors.size() != 1) {
|
||||||
@@ -617,7 +617,7 @@ public class BodyResolver {
|
|||||||
if (classDescriptor.getConstructors().isEmpty()) {
|
if (classDescriptor.getConstructors().isEmpty()) {
|
||||||
trace.report(ANONYMOUS_INITIALIZER_IN_INTERFACE.on(anonymousInitializer));
|
trace.report(ANONYMOUS_INITIALIZER_IN_INTERFACE.on(anonymousInitializer));
|
||||||
}
|
}
|
||||||
if (classDescriptor.isHeader()) {
|
if (classDescriptor.isExpect()) {
|
||||||
trace.report(HEADER_DECLARATION_WITH_BODY.on(anonymousInitializer));
|
trace.report(HEADER_DECLARATION_WITH_BODY.on(anonymousInitializer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class DeclarationResolver(
|
|||||||
// TODO: report error on header class and impl val, or vice versa
|
// TODO: report error on header class and impl val, or vice versa
|
||||||
val (header, impl) =
|
val (header, impl) =
|
||||||
getTopLevelDescriptorsByFqName(topLevelDescriptorProvider, fqName, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
getTopLevelDescriptorsByFqName(topLevelDescriptorProvider, fqName, NoLookupLocation.WHEN_CHECK_DECLARATION_CONFLICTS)
|
||||||
.partition { it is MemberDescriptor && it.isHeader }
|
.partition { it is MemberDescriptor && it.isExpect }
|
||||||
|
|
||||||
for (descriptors in listOf(header, impl)) {
|
for (descriptors in listOf(header, impl)) {
|
||||||
if (descriptors.size > 1) {
|
if (descriptors.size > 1) {
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ class DeclarationsChecker(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun checkHeaderClassConstructor(constructorDescriptor: ClassConstructorDescriptor, declaration: KtConstructor<*>) {
|
private fun checkHeaderClassConstructor(constructorDescriptor: ClassConstructorDescriptor, declaration: KtConstructor<*>) {
|
||||||
if (!constructorDescriptor.isHeader) return
|
if (!constructorDescriptor.isExpect) return
|
||||||
|
|
||||||
if (declaration.hasBody()) {
|
if (declaration.hasBody()) {
|
||||||
trace.report(HEADER_DECLARATION_WITH_BODY.on(declaration))
|
trace.report(HEADER_DECLARATION_WITH_BODY.on(declaration))
|
||||||
@@ -633,11 +633,11 @@ class DeclarationsChecker(
|
|||||||
|
|
||||||
val initializer = property.initializer
|
val initializer = property.initializer
|
||||||
val delegate = property.delegate
|
val delegate = property.delegate
|
||||||
val isHeader = propertyDescriptor.isHeader
|
val isExpect = propertyDescriptor.isExpect
|
||||||
if (initializer != null) {
|
if (initializer != null) {
|
||||||
when {
|
when {
|
||||||
inInterface -> trace.report(PROPERTY_INITIALIZER_IN_INTERFACE.on(initializer))
|
inInterface -> trace.report(PROPERTY_INITIALIZER_IN_INTERFACE.on(initializer))
|
||||||
isHeader -> trace.report(HEADER_PROPERTY_INITIALIZER.on(initializer))
|
isExpect -> trace.report(HEADER_PROPERTY_INITIALIZER.on(initializer))
|
||||||
!backingFieldRequired -> trace.report(PROPERTY_INITIALIZER_NO_BACKING_FIELD.on(initializer))
|
!backingFieldRequired -> trace.report(PROPERTY_INITIALIZER_NO_BACKING_FIELD.on(initializer))
|
||||||
property.receiverTypeReference != null -> trace.report(EXTENSION_PROPERTY_WITH_BACKING_FIELD.on(initializer))
|
property.receiverTypeReference != null -> trace.report(EXTENSION_PROPERTY_WITH_BACKING_FIELD.on(initializer))
|
||||||
}
|
}
|
||||||
@@ -650,7 +650,7 @@ class DeclarationsChecker(
|
|||||||
else {
|
else {
|
||||||
val isUninitialized = trace.bindingContext.get(BindingContext.IS_UNINITIALIZED, propertyDescriptor) ?: false
|
val isUninitialized = trace.bindingContext.get(BindingContext.IS_UNINITIALIZED, propertyDescriptor) ?: false
|
||||||
val isExternal = propertyDescriptor.isEffectivelyExternal()
|
val isExternal = propertyDescriptor.isEffectivelyExternal()
|
||||||
if (backingFieldRequired && !inInterface && !propertyDescriptor.isLateInit && !isHeader && isUninitialized && !isExternal) {
|
if (backingFieldRequired && !inInterface && !propertyDescriptor.isLateInit && !isExpect && isUninitialized && !isExternal) {
|
||||||
if (propertyDescriptor.extensionReceiverParameter != null && !hasAccessorImplementation) {
|
if (propertyDescriptor.extensionReceiverParameter != null && !hasAccessorImplementation) {
|
||||||
trace.report(EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT.on(property))
|
trace.report(EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT.on(property))
|
||||||
}
|
}
|
||||||
@@ -696,7 +696,7 @@ class DeclarationsChecker(
|
|||||||
|
|
||||||
if (containingDescriptor is ClassDescriptor) {
|
if (containingDescriptor is ClassDescriptor) {
|
||||||
val inInterface = containingDescriptor.kind == ClassKind.INTERFACE
|
val inInterface = containingDescriptor.kind == ClassKind.INTERFACE
|
||||||
val isHeaderClass = containingDescriptor.isHeader
|
val isExpectClass = containingDescriptor.isExpect
|
||||||
if (hasAbstractModifier && !classCanHaveAbstractMembers(containingDescriptor)) {
|
if (hasAbstractModifier && !classCanHaveAbstractMembers(containingDescriptor)) {
|
||||||
trace.report(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS.on(function, functionDescriptor.name.asString(), containingDescriptor))
|
trace.report(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS.on(function, functionDescriptor.name.asString(), containingDescriptor))
|
||||||
}
|
}
|
||||||
@@ -712,17 +712,17 @@ class DeclarationsChecker(
|
|||||||
trace.report(REDUNDANT_OPEN_IN_INTERFACE.on(function))
|
trace.report(REDUNDANT_OPEN_IN_INTERFACE.on(function))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasBody && !hasAbstractModifier && !hasExternalModifier && !inInterface && !isHeaderClass) {
|
if (!hasBody && !hasAbstractModifier && !hasExternalModifier && !inInterface && !isExpectClass) {
|
||||||
trace.report(NON_ABSTRACT_FUNCTION_WITH_NO_BODY.on(function, functionDescriptor))
|
trace.report(NON_ABSTRACT_FUNCTION_WITH_NO_BODY.on(function, functionDescriptor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* top-level only */ {
|
else /* top-level only */ {
|
||||||
if (!function.hasBody() && !hasAbstractModifier && !hasExternalModifier && !functionDescriptor.isHeader) {
|
if (!function.hasBody() && !hasAbstractModifier && !hasExternalModifier && !functionDescriptor.isExpect) {
|
||||||
trace.report(NON_MEMBER_FUNCTION_NO_BODY.on(function, functionDescriptor))
|
trace.report(NON_MEMBER_FUNCTION_NO_BODY.on(function, functionDescriptor))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (functionDescriptor.isHeader) {
|
if (functionDescriptor.isExpect) {
|
||||||
checkHeaderFunction(function)
|
checkHeaderFunction(function)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -789,7 +789,7 @@ class DeclarationsChecker(
|
|||||||
accessorDescriptor: PropertyAccessorDescriptor?
|
accessorDescriptor: PropertyAccessorDescriptor?
|
||||||
) {
|
) {
|
||||||
if (accessor == null || accessorDescriptor == null) return
|
if (accessor == null || accessorDescriptor == null) return
|
||||||
if (propertyDescriptor.isHeader && accessor.hasBody()) {
|
if (propertyDescriptor.isExpect && accessor.hasBody()) {
|
||||||
trace.report(HEADER_DECLARATION_WITH_BODY.on(accessor))
|
trace.report(HEADER_DECLARATION_WITH_BODY.on(accessor))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -829,7 +829,7 @@ class DeclarationsChecker(
|
|||||||
private fun checkEnumEntry(enumEntry: KtEnumEntry, enumEntryClass: ClassDescriptor) {
|
private fun checkEnumEntry(enumEntry: KtEnumEntry, enumEntryClass: ClassDescriptor) {
|
||||||
val enumClass = enumEntryClass.containingDeclaration as ClassDescriptor
|
val enumClass = enumEntryClass.containingDeclaration as ClassDescriptor
|
||||||
if (DescriptorUtils.isEnumClass(enumClass)) {
|
if (DescriptorUtils.isEnumClass(enumClass)) {
|
||||||
if (enumClass.isHeader) {
|
if (enumClass.isExpect) {
|
||||||
if (enumEntry.getBody() != null) {
|
if (enumEntry.getBody() != null) {
|
||||||
trace.report(HEADER_ENUM_ENTRY_WITH_BODY.on(enumEntry))
|
trace.report(HEADER_ENUM_ENTRY_WITH_BODY.on(enumEntry))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -875,7 +875,7 @@ public class DescriptorResolver {
|
|||||||
modifierList != null && modifierList.hasModifier(KtTokens.LATEINIT_KEYWORD),
|
modifierList != null && modifierList.hasModifier(KtTokens.LATEINIT_KEYWORD),
|
||||||
modifierList != null && modifierList.hasModifier(KtTokens.CONST_KEYWORD),
|
modifierList != null && modifierList.hasModifier(KtTokens.CONST_KEYWORD),
|
||||||
modifierList != null && PsiUtilsKt.hasExpectModifier(modifierList) && container instanceof PackageFragmentDescriptor ||
|
modifierList != null && PsiUtilsKt.hasExpectModifier(modifierList) && container instanceof PackageFragmentDescriptor ||
|
||||||
container instanceof ClassDescriptor && ((ClassDescriptor) container).isHeader(),
|
container instanceof ClassDescriptor && ((ClassDescriptor) container).isExpect(),
|
||||||
modifierList != null && PsiUtilsKt.hasActualModifier(modifierList),
|
modifierList != null && PsiUtilsKt.hasActualModifier(modifierList),
|
||||||
modifierList != null && modifierList.hasModifier(KtTokens.EXTERNAL_KEYWORD),
|
modifierList != null && modifierList.hasModifier(KtTokens.EXTERNAL_KEYWORD),
|
||||||
propertyInfo.getHasDelegate()
|
propertyInfo.getHasDelegate()
|
||||||
@@ -1201,7 +1201,7 @@ public class DescriptorResolver {
|
|||||||
KotlinSourceElementKt.toSourceElement(parameter),
|
KotlinSourceElementKt.toSourceElement(parameter),
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
classDescriptor.isHeader(),
|
classDescriptor.isExpect(),
|
||||||
modifierList != null && PsiUtilsKt.hasActualModifier(modifierList),
|
modifierList != null && PsiUtilsKt.hasActualModifier(modifierList),
|
||||||
false,
|
false,
|
||||||
false
|
false
|
||||||
|
|||||||
@@ -184,8 +184,8 @@ class FunctionDescriptorResolver(
|
|||||||
functionDescriptor.isInline = function.hasModifier(KtTokens.INLINE_KEYWORD)
|
functionDescriptor.isInline = function.hasModifier(KtTokens.INLINE_KEYWORD)
|
||||||
functionDescriptor.isTailrec = function.hasModifier(KtTokens.TAILREC_KEYWORD)
|
functionDescriptor.isTailrec = function.hasModifier(KtTokens.TAILREC_KEYWORD)
|
||||||
functionDescriptor.isSuspend = function.hasModifier(KtTokens.SUSPEND_KEYWORD)
|
functionDescriptor.isSuspend = function.hasModifier(KtTokens.SUSPEND_KEYWORD)
|
||||||
functionDescriptor.isHeader = container is PackageFragmentDescriptor && function.hasExpectModifier() ||
|
functionDescriptor.isExpect = container is PackageFragmentDescriptor && function.hasExpectModifier() ||
|
||||||
container is ClassDescriptor && container.isHeader
|
container is ClassDescriptor && container.isExpect
|
||||||
functionDescriptor.isImpl = function.hasActualModifier()
|
functionDescriptor.isImpl = function.hasActualModifier()
|
||||||
|
|
||||||
receiverType?.let { ForceResolveUtil.forceResolveAllContents(it.annotations) }
|
receiverType?.let { ForceResolveUtil.forceResolveAllContents(it.annotations) }
|
||||||
@@ -296,8 +296,8 @@ class FunctionDescriptorResolver(
|
|||||||
isPrimary,
|
isPrimary,
|
||||||
declarationToTrace.toSourceElement()
|
declarationToTrace.toSourceElement()
|
||||||
)
|
)
|
||||||
if (classDescriptor.isHeader) {
|
if (classDescriptor.isExpect) {
|
||||||
constructorDescriptor.isHeader = true
|
constructorDescriptor.isExpect = true
|
||||||
}
|
}
|
||||||
if (classDescriptor.isImpl) {
|
if (classDescriptor.isImpl) {
|
||||||
constructorDescriptor.isImpl = true
|
constructorDescriptor.isImpl = true
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class LocalVariableResolver(
|
|||||||
variable.toSourceElement(),
|
variable.toSourceElement(),
|
||||||
/* lateInit = */ false,
|
/* lateInit = */ false,
|
||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isExpect = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false,
|
/* isExternal = */ false,
|
||||||
variable is KtProperty && variable.hasDelegate()
|
variable is KtProperty && variable.hasDelegate()
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ class OverloadResolver(
|
|||||||
if (isConstructorsOfDifferentRedeclaredClasses(member1, member2)) continue
|
if (isConstructorsOfDifferentRedeclaredClasses(member1, member2)) continue
|
||||||
if (isTopLevelMainInDifferentFiles(member1, member2)) continue
|
if (isTopLevelMainInDifferentFiles(member1, member2)) continue
|
||||||
if (isDefinitionsForDifferentPlatforms(member1, member2)) continue
|
if (isDefinitionsForDifferentPlatforms(member1, member2)) continue
|
||||||
if (isHeaderDeclarationAndDefinition(member1, member2) || isHeaderDeclarationAndDefinition(member2, member1)) continue
|
if (isExpectDeclarationAndDefinition(member1, member2) || isExpectDeclarationAndDefinition(member2, member1)) continue
|
||||||
|
|
||||||
if (!overloadChecker.isOverloadable(member1, member2)) {
|
if (!overloadChecker.isOverloadable(member1, member2)) {
|
||||||
redeclarations.add(member1)
|
redeclarations.add(member1)
|
||||||
@@ -282,9 +282,9 @@ class OverloadResolver(
|
|||||||
return file1 == null || file2 == null || file1 !== file2
|
return file1 == null || file2 == null || file1 !== file2
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isHeaderDeclarationAndDefinition(declaration: DeclarationDescriptor, definition: DeclarationDescriptor): Boolean {
|
private fun isExpectDeclarationAndDefinition(declaration: DeclarationDescriptor, definition: DeclarationDescriptor): Boolean {
|
||||||
return declaration is MemberDescriptor && declaration.isHeader &&
|
return declaration is MemberDescriptor && declaration.isExpect &&
|
||||||
definition is MemberDescriptor && !definition.isHeader
|
definition is MemberDescriptor && !definition.isExpect
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isDefinitionsForDifferentPlatforms(member1: DeclarationDescriptorNonRoot, member2: DeclarationDescriptorNonRoot): Boolean {
|
private fun isDefinitionsForDifferentPlatforms(member1: DeclarationDescriptorNonRoot, member2: DeclarationDescriptorNonRoot): Boolean {
|
||||||
|
|||||||
+1
-1
@@ -183,7 +183,7 @@ public class ValueArgumentsToParametersMapper {
|
|||||||
|
|
||||||
KtPsiUtilKt.checkReservedYield(nameReference, candidateCall.getTrace());
|
KtPsiUtilKt.checkReservedYield(nameReference, candidateCall.getTrace());
|
||||||
if (nameReference != null) {
|
if (nameReference != null) {
|
||||||
if (candidate instanceof MemberDescriptor && ((MemberDescriptor) candidate).isHeader() &&
|
if (candidate instanceof MemberDescriptor && ((MemberDescriptor) candidate).isExpect() &&
|
||||||
candidate.getContainingDeclaration() instanceof ClassDescriptor) {
|
candidate.getContainingDeclaration() instanceof ClassDescriptor) {
|
||||||
// We do not allow named arguments for members of header classes until we're able to use both
|
// We do not allow named arguments for members of header classes until we're able to use both
|
||||||
// headers and platform definitions when compiling platform code
|
// headers and platform definitions when compiling platform code
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ class DynamicCallableDescriptors(storageManager: StorageManager, builtIns: Kotli
|
|||||||
SourceElement.NO_SOURCE,
|
SourceElement.NO_SOURCE,
|
||||||
/* lateInit = */ false,
|
/* lateInit = */ false,
|
||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isExpect = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false,
|
/* isExternal = */ false,
|
||||||
/* isDelegated = */ false
|
/* isDelegated = */ false
|
||||||
|
|||||||
+9
-9
@@ -61,7 +61,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
|||||||
|
|
||||||
if (descriptor !is MemberDescriptor || DescriptorUtils.isEnumEntry(descriptor)) return
|
if (descriptor !is MemberDescriptor || DescriptorUtils.isEnumEntry(descriptor)) return
|
||||||
|
|
||||||
if (descriptor.isHeader) {
|
if (descriptor.isExpect) {
|
||||||
checkHeaderDeclarationHasImplementation(declaration, descriptor, diagnosticHolder, descriptor.module)
|
checkHeaderDeclarationHasImplementation(declaration, descriptor, diagnosticHolder, descriptor.module)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -100,7 +100,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
|||||||
return when (header) {
|
return when (header) {
|
||||||
is CallableMemberDescriptor -> {
|
is CallableMemberDescriptor -> {
|
||||||
header.findNamesakesFromModule(platformModule).filter { impl ->
|
header.findNamesakesFromModule(platformModule).filter { impl ->
|
||||||
header != impl && !impl.isHeader &&
|
header != impl && !impl.isExpect &&
|
||||||
// TODO: support non-source definitions (e.g. from Java)
|
// TODO: support non-source definitions (e.g. from Java)
|
||||||
DescriptorToSourceUtils.getSourceFromDescriptor(impl) is KtElement
|
DescriptorToSourceUtils.getSourceFromDescriptor(impl) is KtElement
|
||||||
}.groupBy { impl ->
|
}.groupBy { impl ->
|
||||||
@@ -109,7 +109,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
|||||||
}
|
}
|
||||||
is ClassDescriptor -> {
|
is ClassDescriptor -> {
|
||||||
header.findClassifiersFromModule(platformModule).filter { impl ->
|
header.findClassifiersFromModule(platformModule).filter { impl ->
|
||||||
header != impl && !impl.isHeader &&
|
header != impl && !impl.isExpect &&
|
||||||
DescriptorToSourceUtils.getSourceFromDescriptor(impl) is KtElement
|
DescriptorToSourceUtils.getSourceFromDescriptor(impl) is KtElement
|
||||||
}.groupBy { impl ->
|
}.groupBy { impl ->
|
||||||
areCompatibleClassifiers(header, impl)
|
areCompatibleClassifiers(header, impl)
|
||||||
@@ -201,7 +201,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
candidates.filter { declaration ->
|
candidates.filter { declaration ->
|
||||||
impl != declaration && declaration.isHeader
|
impl != declaration && declaration.isExpect
|
||||||
}.groupBy { declaration ->
|
}.groupBy { declaration ->
|
||||||
// TODO: optimize by caching this per impl-header class pair, do not create a new substitutor for each impl member
|
// TODO: optimize by caching this per impl-header class pair, do not create a new substitutor for each impl member
|
||||||
val substitutor =
|
val substitutor =
|
||||||
@@ -217,7 +217,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
|||||||
is ClassifierDescriptorWithTypeParameters -> {
|
is ClassifierDescriptorWithTypeParameters -> {
|
||||||
impl.findClassifiersFromModule(commonModule).filter { declaration ->
|
impl.findClassifiersFromModule(commonModule).filter { declaration ->
|
||||||
impl != declaration &&
|
impl != declaration &&
|
||||||
declaration is ClassDescriptor && declaration.isHeader
|
declaration is ClassDescriptor && declaration.isExpect
|
||||||
}.groupBy { header ->
|
}.groupBy { header ->
|
||||||
areCompatibleClassifiers(header as ClassDescriptor, impl)
|
areCompatibleClassifiers(header as ClassDescriptor, impl)
|
||||||
}
|
}
|
||||||
@@ -408,8 +408,8 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
|||||||
with(NewKotlinTypeChecker) {
|
with(NewKotlinTypeChecker) {
|
||||||
val context = object : TypeCheckerContext(false) {
|
val context = object : TypeCheckerContext(false) {
|
||||||
override fun areEqualTypeConstructors(a: TypeConstructor, b: TypeConstructor): Boolean {
|
override fun areEqualTypeConstructors(a: TypeConstructor, b: TypeConstructor): Boolean {
|
||||||
return isHeaderClassAndImplTypeAlias(a, b, platformModule) ||
|
return isExpectClassAndImplTypeAlias(a, b, platformModule) ||
|
||||||
isHeaderClassAndImplTypeAlias(b, a, platformModule) ||
|
isExpectClassAndImplTypeAlias(b, a, platformModule) ||
|
||||||
super.areEqualTypeConstructors(a, b)
|
super.areEqualTypeConstructors(a, b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -421,7 +421,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
|||||||
// is java.lang.StringBuilder. For the purposes of type compatibility checking, we must consider these types equal here.
|
// is java.lang.StringBuilder. For the purposes of type compatibility checking, we must consider these types equal here.
|
||||||
// Note that the case of an "impl class" works as expected though, because the impl class by definition has the same FQ name
|
// Note that the case of an "impl class" works as expected though, because the impl class by definition has the same FQ name
|
||||||
// as the corresponding header class, so their type constructors are equal as per AbstractClassTypeConstructor#equals
|
// as the corresponding header class, so their type constructors are equal as per AbstractClassTypeConstructor#equals
|
||||||
private fun isHeaderClassAndImplTypeAlias(
|
private fun isExpectClassAndImplTypeAlias(
|
||||||
headerTypeConstructor: TypeConstructor,
|
headerTypeConstructor: TypeConstructor,
|
||||||
implTypeConstructor: TypeConstructor,
|
implTypeConstructor: TypeConstructor,
|
||||||
platformModule: ModuleDescriptor
|
platformModule: ModuleDescriptor
|
||||||
@@ -429,7 +429,7 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
|
|||||||
val header = headerTypeConstructor.declarationDescriptor
|
val header = headerTypeConstructor.declarationDescriptor
|
||||||
val impl = implTypeConstructor.declarationDescriptor
|
val impl = implTypeConstructor.declarationDescriptor
|
||||||
return header is ClassifierDescriptorWithTypeParameters &&
|
return header is ClassifierDescriptorWithTypeParameters &&
|
||||||
header.isHeader &&
|
header.isExpect &&
|
||||||
impl is ClassifierDescriptorWithTypeParameters &&
|
impl is ClassifierDescriptorWithTypeParameters &&
|
||||||
header.findClassifiersFromModule(platformModule).any { classifier ->
|
header.findClassifiersFromModule(platformModule).any { classifier ->
|
||||||
// Note that it's fine to only check that this "impl typealias" expands to the expected class, without checking
|
// Note that it's fine to only check that this "impl typealias" expands to the expected class, without checking
|
||||||
|
|||||||
+1
-1
@@ -161,7 +161,7 @@ class InlineAnalyzerExtension(
|
|||||||
}
|
}
|
||||||
if (hasInlineArgs) return
|
if (hasInlineArgs) return
|
||||||
|
|
||||||
if (functionDescriptor.isInlineOnlyOrReifiable() || functionDescriptor.isHeader) return
|
if (functionDescriptor.isInlineOnlyOrReifiable() || functionDescriptor.isExpect) return
|
||||||
|
|
||||||
if (reasonableInlineRules.any { it.isInlineReasonable(functionDescriptor, function, trace.bindingContext) }) return
|
if (reasonableInlineRules.any { it.isInlineReasonable(functionDescriptor, function, trace.bindingContext) }) return
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -72,11 +72,11 @@ protected constructor(
|
|||||||
// See getFirstClassifierDiscriminateHeaders()
|
// See getFirstClassifierDiscriminateHeaders()
|
||||||
var result: ClassifierDescriptor? = null
|
var result: ClassifierDescriptor? = null
|
||||||
for (klass in classes) {
|
for (klass in classes) {
|
||||||
if (!klass.isHeader) return klass
|
if (!klass.isExpect) return klass
|
||||||
if (result == null) result = klass
|
if (result == null) result = klass
|
||||||
}
|
}
|
||||||
for (typeAlias in typeAliases) {
|
for (typeAlias in typeAliases) {
|
||||||
if (!typeAlias.isHeader) return typeAlias
|
if (!typeAlias.isExpect) return typeAlias
|
||||||
if (result == null) result = typeAlias
|
if (result == null) result = typeAlias
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|||||||
+6
-6
@@ -91,7 +91,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
|||||||
private final ClassKind kind;
|
private final ClassKind kind;
|
||||||
private final boolean isInner;
|
private final boolean isInner;
|
||||||
private final boolean isData;
|
private final boolean isData;
|
||||||
private final boolean isHeader;
|
private final boolean isExpect;
|
||||||
private final boolean isImpl;
|
private final boolean isImpl;
|
||||||
|
|
||||||
private final Annotations annotations;
|
private final Annotations annotations;
|
||||||
@@ -168,8 +168,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
|||||||
this.isData = modifierList != null && modifierList.hasModifier(KtTokens.DATA_KEYWORD);
|
this.isData = modifierList != null && modifierList.hasModifier(KtTokens.DATA_KEYWORD);
|
||||||
this.isImpl = modifierList != null && PsiUtilsKt.hasActualModifier(modifierList);
|
this.isImpl = modifierList != null && PsiUtilsKt.hasActualModifier(modifierList);
|
||||||
|
|
||||||
this.isHeader = modifierList != null && PsiUtilsKt.hasExpectModifier(modifierList) ||
|
this.isExpect = modifierList != null && PsiUtilsKt.hasExpectModifier(modifierList) ||
|
||||||
containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isHeader();
|
containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isExpect();
|
||||||
|
|
||||||
// Annotation entries are taken from both own annotations (if any) and object literal annotations (if any)
|
// Annotation entries are taken from both own annotations (if any) and object literal annotations (if any)
|
||||||
List<KtAnnotationEntry> annotationEntries = new ArrayList<>();
|
List<KtAnnotationEntry> annotationEntries = new ArrayList<>();
|
||||||
@@ -498,8 +498,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHeader() {
|
public boolean isExpect() {
|
||||||
return isHeader;
|
return isExpect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -527,7 +527,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
// not using DescriptorRenderer to preserve laziness
|
// not using DescriptorRenderer to preserve laziness
|
||||||
return (isHeader ? "header " : isImpl ? "impl " : "") + "class " + getName().toString();
|
return (isExpect ? "header " : isImpl ? "impl " : "") + "class " + getName().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -340,7 +340,7 @@ open class LazyClassMemberScope(
|
|||||||
if (!hasPrimaryConstructor) {
|
if (!hasPrimaryConstructor) {
|
||||||
when (thisDescriptor.kind) {
|
when (thisDescriptor.kind) {
|
||||||
ClassKind.INTERFACE -> return null
|
ClassKind.INTERFACE -> return null
|
||||||
ClassKind.OBJECT, ClassKind.ENUM_CLASS -> if (thisDescriptor.isHeader) return null
|
ClassKind.OBJECT, ClassKind.ENUM_CLASS -> if (thisDescriptor.isExpect) return null
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -277,7 +277,7 @@ class DeepCopyIrTreeWithDescriptors(val targetDescriptor: FunctionDescriptor,
|
|||||||
/* source = */ oldDescriptor.source,
|
/* source = */ oldDescriptor.source,
|
||||||
/* lateInit = */ oldDescriptor.isLateInit,
|
/* lateInit = */ oldDescriptor.isLateInit,
|
||||||
/* isConst = */ oldDescriptor.isConst,
|
/* isConst = */ oldDescriptor.isConst,
|
||||||
/* isHeader = */ oldDescriptor.isHeader,
|
/* isExpect = */ oldDescriptor.isExpect,
|
||||||
/* isImpl = */ oldDescriptor.isImpl,
|
/* isImpl = */ oldDescriptor.isImpl,
|
||||||
/* isExternal = */ oldDescriptor.isExternal,
|
/* isExternal = */ oldDescriptor.isExternal,
|
||||||
/* isDelegated = */ oldDescriptor.isDelegated
|
/* isDelegated = */ oldDescriptor.isDelegated
|
||||||
|
|||||||
+1
-1
@@ -178,7 +178,7 @@ fun BackendContext.createPropertyWithBackingFieldBuilder(startOffset: Int, endOf
|
|||||||
/* source = */ SourceElement.NO_SOURCE,
|
/* source = */ SourceElement.NO_SOURCE,
|
||||||
/* lateInit = */ false,
|
/* lateInit = */ false,
|
||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isExpect = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false,
|
/* isExternal = */ false,
|
||||||
/* isDelegated = */ false
|
/* isDelegated = */ false
|
||||||
|
|||||||
+1
-1
@@ -597,7 +597,7 @@ class LocalDeclarationsLowering(val context: BackendContext) : DeclarationContai
|
|||||||
SourceElement.NO_SOURCE,
|
SourceElement.NO_SOURCE,
|
||||||
/* lateInit = */ false,
|
/* lateInit = */ false,
|
||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isExpect = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false,
|
/* isExternal = */ false,
|
||||||
/* isDelegated = */ false)
|
/* isDelegated = */ false)
|
||||||
|
|||||||
+3
-3
@@ -40,11 +40,11 @@ class JvmPropertyDescriptorImpl private constructor(
|
|||||||
source: SourceElement,
|
source: SourceElement,
|
||||||
isLateInit: Boolean,
|
isLateInit: Boolean,
|
||||||
isConst: Boolean,
|
isConst: Boolean,
|
||||||
isHeader: Boolean,
|
isExpect: Boolean,
|
||||||
isImpl: Boolean
|
isImpl: Boolean
|
||||||
) : JvmDescriptorWithExtraFlags, PropertyDescriptorImpl(
|
) : JvmDescriptorWithExtraFlags, PropertyDescriptorImpl(
|
||||||
containingDeclaration, original, annotations, modality, visibility, isVar,
|
containingDeclaration, original, annotations, modality, visibility, isVar,
|
||||||
name, kind, source, isLateInit, isConst, isHeader, isImpl, /* isExternal = */ false, false
|
name, kind, source, isLateInit, isConst, isExpect, isImpl, /* isExternal = */ false, false
|
||||||
) {
|
) {
|
||||||
override fun createSubstitutedCopy(
|
override fun createSubstitutedCopy(
|
||||||
newOwner: DeclarationDescriptor,
|
newOwner: DeclarationDescriptor,
|
||||||
@@ -56,7 +56,7 @@ class JvmPropertyDescriptorImpl private constructor(
|
|||||||
): PropertyDescriptorImpl =
|
): PropertyDescriptorImpl =
|
||||||
JvmPropertyDescriptorImpl(
|
JvmPropertyDescriptorImpl(
|
||||||
newOwner, original, annotations, newModality, newVisibility, extraFlags, isVar, newName, kind,
|
newOwner, original, annotations, newModality, newVisibility, extraFlags, isVar, newName, kind,
|
||||||
SourceElement.NO_SOURCE, isLateInit, isConst, isHeader, isImpl
|
SourceElement.NO_SOURCE, isLateInit, isConst, isExpect, isImpl
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
+1
-1
@@ -143,7 +143,7 @@ open class KnownClassDescriptor(
|
|||||||
override fun isCompanionObject(): Boolean = false
|
override fun isCompanionObject(): Boolean = false
|
||||||
override fun isData(): Boolean = false
|
override fun isData(): Boolean = false
|
||||||
override fun isInner(): Boolean = false
|
override fun isInner(): Boolean = false
|
||||||
override fun isHeader(): Boolean = false
|
override fun isExpect(): Boolean = false
|
||||||
override fun isImpl(): Boolean = false
|
override fun isImpl(): Boolean = false
|
||||||
override fun isExternal(): Boolean = false
|
override fun isExternal(): Boolean = false
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -53,7 +53,7 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
|
|||||||
PropertyDescriptorImpl.create(
|
PropertyDescriptorImpl.create(
|
||||||
refClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
refClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
||||||
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
||||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
|
/* lateInit = */ false, /* isConst = */ false, /* isExpect = */ false, /* isImpl = */ false,
|
||||||
/* isExternal = */ false, /* isDelegated = */ false
|
/* isExternal = */ false, /* isDelegated = */ false
|
||||||
).initialize(type, dispatchReceiverParameter = refClass.thisAsReceiverParameter)
|
).initialize(type, dispatchReceiverParameter = refClass.thisAsReceiverParameter)
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
|
|||||||
PropertyDescriptorImpl.create(
|
PropertyDescriptorImpl.create(
|
||||||
genericRefClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
genericRefClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
|
||||||
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
|
||||||
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
|
/* lateInit = */ false, /* isConst = */ false, /* isExpect = */ false, /* isImpl = */ false,
|
||||||
/* isExternal = */ false, /* isDelegated = */ false
|
/* isExternal = */ false, /* isDelegated = */ false
|
||||||
).initialize(
|
).initialize(
|
||||||
type = builtIns.anyType,
|
type = builtIns.anyType,
|
||||||
|
|||||||
+1
-1
@@ -130,7 +130,7 @@ class SpecialDescriptorsFactory(
|
|||||||
Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, false,
|
Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, false,
|
||||||
Name.identifier("INSTANCE"),
|
Name.identifier("INSTANCE"),
|
||||||
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
|
||||||
/* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false, /* isDelegated = */ false
|
/* isExpect = */ false, /* isImpl = */ false, /* isExternal = */ false, /* isDelegated = */ false
|
||||||
).initialize(objectDescriptor.defaultType)
|
).initialize(objectDescriptor.defaultType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ abstract class IrBuiltinOperatorDescriptorBase(containingDeclaration: Declaratio
|
|||||||
override fun isOperator(): Boolean = false
|
override fun isOperator(): Boolean = false
|
||||||
override fun isSuspend(): Boolean = false
|
override fun isSuspend(): Boolean = false
|
||||||
override fun isTailrec(): Boolean = false
|
override fun isTailrec(): Boolean = false
|
||||||
override fun isHeader(): Boolean = false
|
override fun isExpect(): Boolean = false
|
||||||
override fun isImpl(): Boolean = false
|
override fun isImpl(): Boolean = false
|
||||||
override fun hasStableParameterNames(): Boolean = true
|
override fun hasStableParameterNames(): Boolean = true
|
||||||
override fun hasSynthesizedParameterNames(): Boolean = false
|
override fun hasSynthesizedParameterNames(): Boolean = false
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ abstract class IrDelegateDescriptorBase(
|
|||||||
SourceElement.NO_SOURCE,
|
SourceElement.NO_SOURCE,
|
||||||
/* lateInit = */ false,
|
/* lateInit = */ false,
|
||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isExpect = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false,
|
/* isExternal = */ false,
|
||||||
/* isDelegated = */ true
|
/* isDelegated = */ true
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class FlatSignature<out T> private constructor(
|
|||||||
val hasExtensionReceiver: Boolean,
|
val hasExtensionReceiver: Boolean,
|
||||||
val hasVarargs: Boolean,
|
val hasVarargs: Boolean,
|
||||||
val numDefaults: Int,
|
val numDefaults: Int,
|
||||||
val isHeader: Boolean,
|
val isExpect: Boolean,
|
||||||
val isSyntheticMember: Boolean
|
val isSyntheticMember: Boolean
|
||||||
) {
|
) {
|
||||||
val isGeneric = typeParameters.isNotEmpty()
|
val isGeneric = typeParameters.isNotEmpty()
|
||||||
@@ -63,7 +63,7 @@ class FlatSignature<out T> private constructor(
|
|||||||
hasExtensionReceiver = false,
|
hasExtensionReceiver = false,
|
||||||
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
||||||
numDefaults = numDefaults,
|
numDefaults = numDefaults,
|
||||||
isHeader = descriptor is MemberDescriptor && descriptor.isHeader,
|
isExpect = descriptor is MemberDescriptor && descriptor.isExpect,
|
||||||
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ class FlatSignature<out T> private constructor(
|
|||||||
hasExtensionReceiver = extensionReceiverType != null,
|
hasExtensionReceiver = extensionReceiverType != null,
|
||||||
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
||||||
numDefaults = numDefaults,
|
numDefaults = numDefaults,
|
||||||
isHeader = descriptor is MemberDescriptor && descriptor.isHeader,
|
isExpect = descriptor is MemberDescriptor && descriptor.isExpect,
|
||||||
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ class FlatSignature<out T> private constructor(
|
|||||||
hasExtensionReceiver = false,
|
hasExtensionReceiver = false,
|
||||||
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
|
||||||
numDefaults = descriptor.valueParameters.count { it.hasDefaultValue() },
|
numDefaults = descriptor.valueParameters.count { it.hasDefaultValue() },
|
||||||
isHeader = descriptor is MemberDescriptor && descriptor.isHeader,
|
isExpect = descriptor is MemberDescriptor && descriptor.isExpect,
|
||||||
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -263,8 +263,8 @@ open class OverloadingConflictResolver<C : Any>(
|
|||||||
if (isGeneric1 && isGeneric2) return false
|
if (isGeneric1 && isGeneric2) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!call1.isHeader && call2.isHeader) return true
|
if (!call1.isExpect && call2.isExpect) return true
|
||||||
if (call1.isHeader && !call2.isHeader) return false
|
if (call1.isExpect && !call2.isExpect) return false
|
||||||
|
|
||||||
return createEmptyConstraintSystem().isSignatureNotLessSpecific(call1, call2, SpecificityComparisonWithNumerics, specificityComparator)
|
return createEmptyConstraintSystem().isSignatureNotLessSpecific(call1, call2, SpecificityComparisonWithNumerics, specificityComparator)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -66,7 +66,7 @@ class DescriptorSerializer private constructor(
|
|||||||
val flags = Flags.getClassFlags(
|
val flags = Flags.getClassFlags(
|
||||||
hasAnnotations(classDescriptor), classDescriptor.visibility, classDescriptor.modality, classDescriptor.kind,
|
hasAnnotations(classDescriptor), classDescriptor.visibility, classDescriptor.modality, classDescriptor.kind,
|
||||||
classDescriptor.isInner, classDescriptor.isCompanionObject, classDescriptor.isData, classDescriptor.isExternal,
|
classDescriptor.isInner, classDescriptor.isCompanionObject, classDescriptor.isData, classDescriptor.isExternal,
|
||||||
classDescriptor.isHeader
|
classDescriptor.isExpect
|
||||||
)
|
)
|
||||||
if (flags != builder.flags) {
|
if (flags != builder.flags) {
|
||||||
builder.flags = flags
|
builder.flags = flags
|
||||||
@@ -187,7 +187,7 @@ class DescriptorSerializer private constructor(
|
|||||||
val flags = Flags.getPropertyFlags(
|
val flags = Flags.getPropertyFlags(
|
||||||
hasAnnotations, descriptor.visibility, descriptor.modality, descriptor.kind, descriptor.isVar,
|
hasAnnotations, descriptor.visibility, descriptor.modality, descriptor.kind, descriptor.isVar,
|
||||||
hasGetter, hasSetter, hasConstant, descriptor.isConst, descriptor.isLateInit, descriptor.isExternal,
|
hasGetter, hasSetter, hasConstant, descriptor.isConst, descriptor.isLateInit, descriptor.isExternal,
|
||||||
@Suppress("DEPRECATION") descriptor.isDelegated, descriptor.isHeader
|
@Suppress("DEPRECATION") descriptor.isDelegated, descriptor.isExpect
|
||||||
)
|
)
|
||||||
if (flags != builder.flags) {
|
if (flags != builder.flags) {
|
||||||
builder.flags = flags
|
builder.flags = flags
|
||||||
@@ -233,7 +233,7 @@ class DescriptorSerializer private constructor(
|
|||||||
val flags = Flags.getFunctionFlags(
|
val flags = Flags.getFunctionFlags(
|
||||||
hasAnnotations(descriptor), descriptor.visibility, descriptor.modality, descriptor.kind, descriptor.isOperator,
|
hasAnnotations(descriptor), descriptor.visibility, descriptor.modality, descriptor.kind, descriptor.isOperator,
|
||||||
descriptor.isInfix, descriptor.isInline, descriptor.isTailrec, descriptor.isExternal, descriptor.isSuspend,
|
descriptor.isInfix, descriptor.isInline, descriptor.isTailrec, descriptor.isExternal, descriptor.isSuspend,
|
||||||
descriptor.isHeader
|
descriptor.isExpect
|
||||||
)
|
)
|
||||||
if (flags != builder.flags) {
|
if (flags != builder.flags) {
|
||||||
builder.flags = flags
|
builder.flags = flags
|
||||||
|
|||||||
+1
-1
@@ -195,7 +195,7 @@ public class RecursiveDescriptorComparator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 'header' declarations do not belong to the platform-specific module, even though they participate in the analysis
|
// 'header' declarations do not belong to the platform-specific module, even though they participate in the analysis
|
||||||
if (descriptor instanceof MemberDescriptor && ((MemberDescriptor) descriptor).isHeader() &&
|
if (descriptor instanceof MemberDescriptor && ((MemberDescriptor) descriptor).isExpect() &&
|
||||||
module.getCapability(MultiTargetPlatform.CAPABILITY) != MultiTargetPlatform.Common.INSTANCE) return false;
|
module.getCapability(MultiTargetPlatform.CAPABILITY) != MultiTargetPlatform.Common.INSTANCE) return false;
|
||||||
|
|
||||||
return module.equals(DescriptorUtils.getContainingModule(descriptor));
|
return module.equals(DescriptorUtils.getContainingModule(descriptor));
|
||||||
|
|||||||
+1
-1
@@ -102,7 +102,7 @@ class LazyJavaClassDescriptor(
|
|||||||
override fun isInner() = isInner
|
override fun isInner() = isInner
|
||||||
override fun isData() = false
|
override fun isData() = false
|
||||||
override fun isCompanionObject() = false
|
override fun isCompanionObject() = false
|
||||||
override fun isHeader() = false
|
override fun isExpect() = false
|
||||||
override fun isImpl() = false
|
override fun isImpl() = false
|
||||||
|
|
||||||
private val typeConstructor = LazyJavaClassTypeConstructor()
|
private val typeConstructor = LazyJavaClassTypeConstructor()
|
||||||
|
|||||||
+1
-1
@@ -100,7 +100,7 @@ class FunctionClassDescriptor(
|
|||||||
override fun isCompanionObject() = false
|
override fun isCompanionObject() = false
|
||||||
override fun isInner() = false
|
override fun isInner() = false
|
||||||
override fun isData() = false
|
override fun isData() = false
|
||||||
override fun isHeader() = false
|
override fun isExpect() = false
|
||||||
override fun isImpl() = false
|
override fun isImpl() = false
|
||||||
override fun isExternal() = false
|
override fun isExternal() = false
|
||||||
override val annotations: Annotations get() = Annotations.EMPTY
|
override val annotations: Annotations get() = Annotations.EMPTY
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public interface MemberDescriptor extends DeclarationDescriptorNonRoot, Declarat
|
|||||||
@NotNull
|
@NotNull
|
||||||
Visibility getVisibility();
|
Visibility getVisibility();
|
||||||
|
|
||||||
boolean isHeader();
|
boolean isExpect();
|
||||||
|
|
||||||
boolean isImpl();
|
boolean isImpl();
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class NotFoundClasses(private val storageManager: StorageManager, private val mo
|
|||||||
|
|
||||||
override fun isCompanionObject() = false
|
override fun isCompanionObject() = false
|
||||||
override fun isData() = false
|
override fun isData() = false
|
||||||
override fun isHeader() = false
|
override fun isExpect() = false
|
||||||
override fun isImpl() = false
|
override fun isImpl() = false
|
||||||
override fun isExternal() = false
|
override fun isExternal() = false
|
||||||
override val annotations: Annotations get() = Annotations.EMPTY
|
override val annotations: Annotations get() = Annotations.EMPTY
|
||||||
|
|||||||
+1
-1
@@ -74,7 +74,7 @@ abstract class AbstractTypeAliasDescriptor(
|
|||||||
|
|
||||||
override fun getVisibility() = visibilityImpl
|
override fun getVisibility() = visibilityImpl
|
||||||
|
|
||||||
override fun isHeader(): Boolean = false
|
override fun isExpect(): Boolean = false
|
||||||
|
|
||||||
override fun isImpl(): Boolean = false
|
override fun isImpl(): Boolean = false
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class ClassDescriptorImpl extends ClassDescriptorBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHeader() {
|
public boolean isExpect() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -155,7 +155,7 @@ public class EnumEntrySyntheticClassDescriptor extends ClassDescriptorBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHeader() {
|
public boolean isExpect() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -43,7 +43,7 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
private boolean isExternal = false;
|
private boolean isExternal = false;
|
||||||
private boolean isInline = false;
|
private boolean isInline = false;
|
||||||
private boolean isTailrec = false;
|
private boolean isTailrec = false;
|
||||||
private boolean isHeader = false;
|
private boolean isExpect = false;
|
||||||
private boolean isImpl = false;
|
private boolean isImpl = false;
|
||||||
// Difference between these hidden kinds:
|
// Difference between these hidden kinds:
|
||||||
// 1. isHiddenToOvercomeSignatureClash prohibit calling such functions even in super-call context
|
// 1. isHiddenToOvercomeSignatureClash prohibit calling such functions even in super-call context
|
||||||
@@ -136,8 +136,8 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
this.isTailrec = isTailrec;
|
this.isTailrec = isTailrec;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHeader(boolean isHeader) {
|
public void setExpect(boolean isExpect) {
|
||||||
this.isHeader = isHeader;
|
this.isExpect = isExpect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setImpl(boolean isImpl) {
|
public void setImpl(boolean isImpl) {
|
||||||
@@ -258,8 +258,8 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHeader() {
|
public boolean isExpect() {
|
||||||
return isHeader;
|
return isExpect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -664,7 +664,7 @@ public abstract class FunctionDescriptorImpl extends DeclarationDescriptorNonRoo
|
|||||||
substitutedDescriptor.setInline(isInline);
|
substitutedDescriptor.setInline(isInline);
|
||||||
substitutedDescriptor.setTailrec(isTailrec);
|
substitutedDescriptor.setTailrec(isTailrec);
|
||||||
substitutedDescriptor.setSuspend(isSuspend);
|
substitutedDescriptor.setSuspend(isSuspend);
|
||||||
substitutedDescriptor.setHeader(isHeader);
|
substitutedDescriptor.setExpect(isExpect);
|
||||||
substitutedDescriptor.setImpl(isImpl);
|
substitutedDescriptor.setImpl(isImpl);
|
||||||
substitutedDescriptor.setHasStableParameterNames(hasStableParameterNames);
|
substitutedDescriptor.setHasStableParameterNames(hasStableParameterNames);
|
||||||
substitutedDescriptor.setHiddenToOvercomeSignatureClash(configuration.isHiddenToOvercomeSignatureClash);
|
substitutedDescriptor.setHiddenToOvercomeSignatureClash(configuration.isHiddenToOvercomeSignatureClash);
|
||||||
|
|||||||
+2
-2
@@ -227,8 +227,8 @@ public class LazySubstitutingClassDescriptor implements ClassDescriptor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHeader() {
|
public boolean isExpect() {
|
||||||
return original.isHeader();
|
return original.isExpect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -107,7 +107,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHeader() {
|
public boolean isExpect() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -103,7 +103,7 @@ public abstract class PropertyAccessorDescriptorImpl extends DeclarationDescript
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHeader() {
|
public boolean isExpect() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+8
-8
@@ -42,7 +42,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
private final Kind kind;
|
private final Kind kind;
|
||||||
private final boolean lateInit;
|
private final boolean lateInit;
|
||||||
private final boolean isConst;
|
private final boolean isConst;
|
||||||
private final boolean isHeader;
|
private final boolean isExpect;
|
||||||
private final boolean isImpl;
|
private final boolean isImpl;
|
||||||
private final boolean isExternal;
|
private final boolean isExternal;
|
||||||
private final boolean isDelegated;
|
private final boolean isDelegated;
|
||||||
@@ -66,7 +66,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
@NotNull SourceElement source,
|
@NotNull SourceElement source,
|
||||||
boolean lateInit,
|
boolean lateInit,
|
||||||
boolean isConst,
|
boolean isConst,
|
||||||
boolean isHeader,
|
boolean isExpect,
|
||||||
boolean isImpl,
|
boolean isImpl,
|
||||||
boolean isExternal,
|
boolean isExternal,
|
||||||
boolean isDelegated
|
boolean isDelegated
|
||||||
@@ -78,7 +78,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
this.lateInit = lateInit;
|
this.lateInit = lateInit;
|
||||||
this.isConst = isConst;
|
this.isConst = isConst;
|
||||||
this.isHeader = isHeader;
|
this.isExpect = isExpect;
|
||||||
this.isImpl = isImpl;
|
this.isImpl = isImpl;
|
||||||
this.isExternal = isExternal;
|
this.isExternal = isExternal;
|
||||||
this.isDelegated = isDelegated;
|
this.isDelegated = isDelegated;
|
||||||
@@ -96,14 +96,14 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
@NotNull SourceElement source,
|
@NotNull SourceElement source,
|
||||||
boolean lateInit,
|
boolean lateInit,
|
||||||
boolean isConst,
|
boolean isConst,
|
||||||
boolean isHeader,
|
boolean isExpect,
|
||||||
boolean isImpl,
|
boolean isImpl,
|
||||||
boolean isExternal,
|
boolean isExternal,
|
||||||
boolean isDelegated
|
boolean isDelegated
|
||||||
) {
|
) {
|
||||||
return new PropertyDescriptorImpl(containingDeclaration, null, annotations,
|
return new PropertyDescriptorImpl(containingDeclaration, null, annotations,
|
||||||
modality, visibility, isVar, name, kind, source, lateInit, isConst,
|
modality, visibility, isVar, name, kind, source, lateInit, isConst,
|
||||||
isHeader, isImpl, isExternal, isDelegated);
|
isExpect, isImpl, isExternal, isDelegated);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setType(
|
public void setType(
|
||||||
@@ -458,7 +458,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
) {
|
) {
|
||||||
return new PropertyDescriptorImpl(
|
return new PropertyDescriptorImpl(
|
||||||
newOwner, original, getAnnotations(), newModality, newVisibility, isVar(), newName, kind, SourceElement.NO_SOURCE,
|
newOwner, original, getAnnotations(), newModality, newVisibility, isVar(), newName, kind, SourceElement.NO_SOURCE,
|
||||||
isLateInit(), isConst(), isHeader(), isImpl(), isExternal(), isDelegated()
|
isLateInit(), isConst(), isExpect(), isImpl(), isExternal(), isDelegated()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -480,8 +480,8 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isHeader() {
|
public boolean isExpect() {
|
||||||
return isHeader;
|
return isExpect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ internal class DescriptorRendererImpl(
|
|||||||
|
|
||||||
private fun renderMemberModifiers(descriptor: MemberDescriptor, builder: StringBuilder) {
|
private fun renderMemberModifiers(descriptor: MemberDescriptor, builder: StringBuilder) {
|
||||||
renderModifier(builder, descriptor.isExternal, "external")
|
renderModifier(builder, descriptor.isExternal, "external")
|
||||||
renderModifier(builder, DescriptorRendererModifier.HEADER in modifiers && descriptor.isHeader, "header")
|
renderModifier(builder, DescriptorRendererModifier.HEADER in modifiers && descriptor.isExpect, "header")
|
||||||
renderModifier(builder, DescriptorRendererModifier.IMPL in modifiers && descriptor.isImpl, "impl")
|
renderModifier(builder, DescriptorRendererModifier.IMPL in modifiers && descriptor.isImpl, "impl")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ inline fun <Scope, T : ClassifierDescriptor> getFirstClassifierDiscriminateHeade
|
|||||||
for (scope in scopes) {
|
for (scope in scopes) {
|
||||||
val newResult = callback(scope)
|
val newResult = callback(scope)
|
||||||
if (newResult != null) {
|
if (newResult != null) {
|
||||||
if (newResult is ClassifierDescriptorWithTypeParameters && newResult.isHeader) {
|
if (newResult is ClassifierDescriptorWithTypeParameters && newResult.isExpect) {
|
||||||
if (result == null) result = newResult
|
if (result == null) result = newResult
|
||||||
}
|
}
|
||||||
// this class is Impl or usual class
|
// this class is Impl or usual class
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class Flags {
|
|||||||
boolean isCompanionObject,
|
boolean isCompanionObject,
|
||||||
boolean isData,
|
boolean isData,
|
||||||
boolean isExternal,
|
boolean isExternal,
|
||||||
boolean isHeader
|
boolean isExpect
|
||||||
) {
|
) {
|
||||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||||
| MODALITY.toFlags(modality(modality))
|
| MODALITY.toFlags(modality(modality))
|
||||||
@@ -107,7 +107,7 @@ public class Flags {
|
|||||||
| IS_INNER.toFlags(inner)
|
| IS_INNER.toFlags(inner)
|
||||||
| IS_DATA.toFlags(isData)
|
| IS_DATA.toFlags(isData)
|
||||||
| IS_EXTERNAL_CLASS.toFlags(isExternal)
|
| IS_EXTERNAL_CLASS.toFlags(isExternal)
|
||||||
| IS_HEADER_CLASS.toFlags(isHeader)
|
| IS_HEADER_CLASS.toFlags(isExpect)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ public class Flags {
|
|||||||
boolean isTailrec,
|
boolean isTailrec,
|
||||||
boolean isExternal,
|
boolean isExternal,
|
||||||
boolean isSuspend,
|
boolean isSuspend,
|
||||||
boolean isHeader
|
boolean isExpect
|
||||||
) {
|
) {
|
||||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||||
| VISIBILITY.toFlags(visibility(visibility))
|
| VISIBILITY.toFlags(visibility(visibility))
|
||||||
@@ -165,7 +165,7 @@ public class Flags {
|
|||||||
| IS_TAILREC.toFlags(isTailrec)
|
| IS_TAILREC.toFlags(isTailrec)
|
||||||
| IS_EXTERNAL_FUNCTION.toFlags(isExternal)
|
| IS_EXTERNAL_FUNCTION.toFlags(isExternal)
|
||||||
| IS_SUSPEND.toFlags(isSuspend)
|
| IS_SUSPEND.toFlags(isSuspend)
|
||||||
| IS_HEADER_FUNCTION.toFlags(isHeader)
|
| IS_HEADER_FUNCTION.toFlags(isExpect)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ public class Flags {
|
|||||||
boolean lateInit,
|
boolean lateInit,
|
||||||
boolean isExternal,
|
boolean isExternal,
|
||||||
boolean isDelegated,
|
boolean isDelegated,
|
||||||
boolean isHeader
|
boolean isExpect
|
||||||
) {
|
) {
|
||||||
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
return HAS_ANNOTATIONS.toFlags(hasAnnotations)
|
||||||
| VISIBILITY.toFlags(visibility(visibility))
|
| VISIBILITY.toFlags(visibility(visibility))
|
||||||
@@ -196,7 +196,7 @@ public class Flags {
|
|||||||
| HAS_CONSTANT.toFlags(hasConstant)
|
| HAS_CONSTANT.toFlags(hasConstant)
|
||||||
| IS_EXTERNAL_PROPERTY.toFlags(isExternal)
|
| IS_EXTERNAL_PROPERTY.toFlags(isExternal)
|
||||||
| IS_DELEGATED.toFlags(isDelegated)
|
| IS_DELEGATED.toFlags(isDelegated)
|
||||||
| IS_HEADER_PROPERTY.toFlags(isHeader)
|
| IS_HEADER_PROPERTY.toFlags(isExpect)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -175,7 +175,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
function.isInline = Flags.IS_INLINE.get(flags)
|
function.isInline = Flags.IS_INLINE.get(flags)
|
||||||
function.isTailrec = Flags.IS_TAILREC.get(flags)
|
function.isTailrec = Flags.IS_TAILREC.get(flags)
|
||||||
function.isSuspend = Flags.IS_SUSPEND.get(flags)
|
function.isSuspend = Flags.IS_SUSPEND.get(flags)
|
||||||
function.isHeader = Flags.IS_HEADER_FUNCTION.get(flags)
|
function.isExpect = Flags.IS_HEADER_FUNCTION.get(flags)
|
||||||
return function
|
return function
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -98,7 +98,7 @@ class DeserializedClassDescriptor(
|
|||||||
|
|
||||||
override fun isData() = Flags.IS_DATA.get(classProto.flags)
|
override fun isData() = Flags.IS_DATA.get(classProto.flags)
|
||||||
|
|
||||||
override fun isHeader() = Flags.IS_HEADER_CLASS.get(classProto.flags)
|
override fun isExpect() = Flags.IS_HEADER_CLASS.get(classProto.flags)
|
||||||
|
|
||||||
override fun isImpl() = false
|
override fun isImpl() = false
|
||||||
|
|
||||||
|
|||||||
+3
-5
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.serialization.deserialization.descriptors
|
package org.jetbrains.kotlin.serialization.deserialization.descriptors
|
||||||
|
|
||||||
import org.jetbrains.annotations.NotNull
|
|
||||||
import org.jetbrains.annotations.Nullable
|
|
||||||
import org.jetbrains.kotlin.descriptors.*
|
import org.jetbrains.kotlin.descriptors.*
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||||
import org.jetbrains.kotlin.descriptors.impl.*
|
import org.jetbrains.kotlin.descriptors.impl.*
|
||||||
@@ -106,7 +104,7 @@ class DeserializedPropertyDescriptor(
|
|||||||
isConst: Boolean,
|
isConst: Boolean,
|
||||||
isExternal: Boolean,
|
isExternal: Boolean,
|
||||||
isDelegated: Boolean,
|
isDelegated: Boolean,
|
||||||
isHeader: Boolean,
|
isExpect: Boolean,
|
||||||
override val proto: ProtoBuf.Property,
|
override val proto: ProtoBuf.Property,
|
||||||
override val nameResolver: NameResolver,
|
override val nameResolver: NameResolver,
|
||||||
override val typeTable: TypeTable,
|
override val typeTable: TypeTable,
|
||||||
@@ -114,7 +112,7 @@ class DeserializedPropertyDescriptor(
|
|||||||
override val containerSource: DeserializedContainerSource?
|
override val containerSource: DeserializedContainerSource?
|
||||||
) : DeserializedCallableMemberDescriptor, PropertyDescriptorImpl(
|
) : DeserializedCallableMemberDescriptor, PropertyDescriptorImpl(
|
||||||
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE,
|
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, SourceElement.NO_SOURCE,
|
||||||
isLateInit, isConst, isHeader, false, isExternal, isDelegated
|
isLateInit, isConst, isExpect, false, isExternal, isDelegated
|
||||||
) {
|
) {
|
||||||
override fun createSubstitutedCopy(
|
override fun createSubstitutedCopy(
|
||||||
newOwner: DeclarationDescriptor,
|
newOwner: DeclarationDescriptor,
|
||||||
@@ -126,7 +124,7 @@ class DeserializedPropertyDescriptor(
|
|||||||
): PropertyDescriptorImpl {
|
): PropertyDescriptorImpl {
|
||||||
return DeserializedPropertyDescriptor(
|
return DeserializedPropertyDescriptor(
|
||||||
newOwner, original, annotations, newModality, newVisibility, isVar, newName, kind, isLateInit, isConst, isExternal,
|
newOwner, original, annotations, newModality, newVisibility, isVar, newName, kind, isLateInit, isConst, isExternal,
|
||||||
@Suppress("DEPRECATION") isDelegated, isHeader, proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource
|
@Suppress("DEPRECATION") isDelegated, isExpect, proto, nameResolver, typeTable, sinceKotlinInfoTable, containerSource
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -56,7 +56,7 @@ val ModuleDescriptor.allImplementingCompatibleModules
|
|||||||
class PlatformHeaderAnnotator : Annotator {
|
class PlatformHeaderAnnotator : Annotator {
|
||||||
override fun annotate(element: PsiElement, holder: AnnotationHolder) {
|
override fun annotate(element: PsiElement, holder: AnnotationHolder) {
|
||||||
val declaration = element as? KtDeclaration ?: return
|
val declaration = element as? KtDeclaration ?: return
|
||||||
if (!isHeaderDeclaration(declaration)) return
|
if (!isExpectDeclaration(declaration)) return
|
||||||
|
|
||||||
if (TargetPlatformDetector.getPlatform(declaration.containingKtFile) !is TargetPlatform.Common) return
|
if (TargetPlatformDetector.getPlatform(declaration.containingKtFile) !is TargetPlatform.Common) return
|
||||||
|
|
||||||
@@ -64,7 +64,7 @@ class PlatformHeaderAnnotator : Annotator {
|
|||||||
if (implementingModules.isEmpty()) return
|
if (implementingModules.isEmpty()) return
|
||||||
|
|
||||||
val descriptor = declaration.toDescriptor() as? MemberDescriptor ?: return
|
val descriptor = declaration.toDescriptor() as? MemberDescriptor ?: return
|
||||||
if (!descriptor.isHeader) return
|
if (!descriptor.isExpect) return
|
||||||
|
|
||||||
val trace = BindingTraceContext()
|
val trace = BindingTraceContext()
|
||||||
for (module in implementingModules) {
|
for (module in implementingModules) {
|
||||||
@@ -80,7 +80,7 @@ class PlatformHeaderAnnotator : Annotator {
|
|||||||
KotlinPsiChecker().annotateElement(declaration, holder, SimpleDiagnostics(filteredList))
|
KotlinPsiChecker().annotateElement(declaration, holder, SimpleDiagnostics(filteredList))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isHeaderDeclaration(declaration: KtDeclaration): Boolean {
|
private fun isExpectDeclaration(declaration: KtDeclaration): Boolean {
|
||||||
return declaration.hasExpectModifier() ||
|
return declaration.hasExpectModifier() ||
|
||||||
declaration is KtClassOrObject && KtPsiUtil.getOutermostClassOrObject(declaration)?.hasExpectModifier() == true
|
declaration is KtClassOrObject && KtPsiUtil.getOutermostClassOrObject(declaration)?.hasExpectModifier() == true
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -148,7 +148,7 @@ private val OVERRIDE_RENDERER = DescriptorRenderer.withOptions {
|
|||||||
private fun PropertyDescriptor.wrap(): PropertyDescriptor {
|
private fun PropertyDescriptor.wrap(): PropertyDescriptor {
|
||||||
val delegate = copy(containingDeclaration, Modality.OPEN, visibility, kind, true) as PropertyDescriptor
|
val delegate = copy(containingDeclaration, Modality.OPEN, visibility, kind, true) as PropertyDescriptor
|
||||||
val newDescriptor = object : PropertyDescriptor by delegate {
|
val newDescriptor = object : PropertyDescriptor by delegate {
|
||||||
override fun isHeader() = false
|
override fun isExpect() = false
|
||||||
}
|
}
|
||||||
newDescriptor.setSingleOverridden(this)
|
newDescriptor.setSingleOverridden(this)
|
||||||
return newDescriptor
|
return newDescriptor
|
||||||
@@ -156,7 +156,7 @@ private fun PropertyDescriptor.wrap(): PropertyDescriptor {
|
|||||||
|
|
||||||
private fun FunctionDescriptor.wrap(): FunctionDescriptor {
|
private fun FunctionDescriptor.wrap(): FunctionDescriptor {
|
||||||
return object : FunctionDescriptor by this {
|
return object : FunctionDescriptor by this {
|
||||||
override fun isHeader() = false
|
override fun isExpect() = false
|
||||||
override fun getModality() = Modality.OPEN
|
override fun getModality() = Modality.OPEN
|
||||||
override fun getReturnType() = this@wrap.returnType?.approximateFlexibleTypes(preferNotNull = true, preferStarForRaw = true)
|
override fun getReturnType() = this@wrap.returnType?.approximateFlexibleTypes(preferNotNull = true, preferStarForRaw = true)
|
||||||
override fun getOverriddenDescriptors() = listOf(this@wrap)
|
override fun getOverriddenDescriptors() = listOf(this@wrap)
|
||||||
|
|||||||
+3
-3
@@ -46,14 +46,14 @@ class KotlinMultiplatformJUnitRecognizer : JUnitRecognizer() {
|
|||||||
|
|
||||||
val bindingContext = origin.analyze(BodyResolveMode.PARTIAL)
|
val bindingContext = origin.analyze(BodyResolveMode.PARTIAL)
|
||||||
val methodDescriptor = bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, origin] ?: return false
|
val methodDescriptor = bindingContext[BindingContext.DECLARATION_TO_DESCRIPTOR, origin] ?: return false
|
||||||
return methodDescriptor.annotations.getAllAnnotations().any { it.isHeaderOfAnnotation("org.junit.Test", implModules) }
|
return methodDescriptor.annotations.getAllAnnotations().any { it.isExpectOfAnnotation("org.junit.Test", implModules) }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun AnnotationWithTarget.isHeaderOfAnnotation(fqName: String, implModules: Collection<ModuleDescriptor>): Boolean {
|
private fun AnnotationWithTarget.isExpectOfAnnotation(fqName: String, implModules: Collection<ModuleDescriptor>): Boolean {
|
||||||
val annotationClass = annotation.type.constructor.declarationDescriptor as? ClassifierDescriptorWithTypeParameters ?: return false
|
val annotationClass = annotation.type.constructor.declarationDescriptor as? ClassifierDescriptorWithTypeParameters ?: return false
|
||||||
if (!annotationClass.isHeader) return false
|
if (!annotationClass.isExpect) return false
|
||||||
|
|
||||||
return implModules
|
return implModules
|
||||||
.any { module ->
|
.any { module ->
|
||||||
|
|||||||
@@ -65,13 +65,13 @@ internal fun KtDeclaration.headerDeclarationIfAny(): KtDeclaration? {
|
|||||||
return DescriptorToSourceUtils.descriptorToDeclaration(headerDescriptor) as? KtDeclaration
|
return DescriptorToSourceUtils.descriptorToDeclaration(headerDescriptor) as? KtDeclaration
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun KtDeclaration.isHeaderOrHeaderClassMember() =
|
internal fun KtDeclaration.isExpectOrExpectClassMember() =
|
||||||
hasExpectModifier() || (containingClassOrObject?.hasExpectModifier() ?: false)
|
hasExpectModifier() || (containingClassOrObject?.hasExpectModifier() ?: false)
|
||||||
|
|
||||||
internal fun DeclarationDescriptor.liftToHeader(): DeclarationDescriptor? {
|
internal fun DeclarationDescriptor.liftToHeader(): DeclarationDescriptor? {
|
||||||
if (this is MemberDescriptor) {
|
if (this is MemberDescriptor) {
|
||||||
return when {
|
return when {
|
||||||
isHeader -> this
|
isExpect -> this
|
||||||
isImpl -> headerDescriptor()
|
isImpl -> headerDescriptor()
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ fun navigateToPlatformImplementation(e: MouseEvent?, declaration: KtDeclaration)
|
|||||||
|
|
||||||
private fun DeclarationDescriptor.headerImplementations(): Collection<DeclarationDescriptor> {
|
private fun DeclarationDescriptor.headerImplementations(): Collection<DeclarationDescriptor> {
|
||||||
if (this is MemberDescriptor) {
|
if (this is MemberDescriptor) {
|
||||||
if (!this.isHeader) return emptyList()
|
if (!this.isExpect) return emptyList()
|
||||||
|
|
||||||
return module.allImplementingCompatibleModules.flatMap { it.implementationsOf(this) }
|
return module.allImplementingCompatibleModules.flatMap { it.implementationsOf(this) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ abstract class AbstractAddAccessorsIntention(
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
val descriptor = element.resolveToDescriptorIfAny() as? CallableMemberDescriptor ?: return null
|
val descriptor = element.resolveToDescriptorIfAny() as? CallableMemberDescriptor ?: return null
|
||||||
if (descriptor.isHeader) return null
|
if (descriptor.isExpect) return null
|
||||||
|
|
||||||
if (addSetter && (!element.isVar || element.setter != null)) return null
|
if (addSetter && (!element.isVar || element.setter != null)) return null
|
||||||
if (addGetter && element.getter != null) return null
|
if (addGetter && element.getter != null) return null
|
||||||
|
|||||||
+2
-2
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
|||||||
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
|
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
|
||||||
import org.jetbrains.kotlin.idea.core.*
|
import org.jetbrains.kotlin.idea.core.*
|
||||||
import org.jetbrains.kotlin.idea.highlighter.markers.headerImplementations
|
import org.jetbrains.kotlin.idea.highlighter.markers.headerImplementations
|
||||||
import org.jetbrains.kotlin.idea.highlighter.markers.isHeaderOrHeaderClassMember
|
import org.jetbrains.kotlin.idea.highlighter.markers.isExpectOrExpectClassMember
|
||||||
import org.jetbrains.kotlin.idea.highlighter.markers.liftToHeader
|
import org.jetbrains.kotlin.idea.highlighter.markers.liftToHeader
|
||||||
import org.jetbrains.kotlin.idea.intentions.SelfTargetingRangeIntention
|
import org.jetbrains.kotlin.idea.intentions.SelfTargetingRangeIntention
|
||||||
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.getReturnTypeReference
|
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.getReturnTypeReference
|
||||||
@@ -111,7 +111,7 @@ class ConvertMemberToExtensionIntention : SelfTargetingRangeIntention<KtCallable
|
|||||||
val descriptor = element.unsafeResolveToDescriptor()
|
val descriptor = element.unsafeResolveToDescriptor()
|
||||||
val containingClass = descriptor.containingDeclaration as ClassDescriptor
|
val containingClass = descriptor.containingDeclaration as ClassDescriptor
|
||||||
|
|
||||||
val isEffectiveHeader = allowHeader && element.isHeaderOrHeaderClassMember()
|
val isEffectiveHeader = allowHeader && element.isExpectOrExpectClassMember()
|
||||||
|
|
||||||
val file = element.containingKtFile
|
val file = element.containingKtFile
|
||||||
val project = file.project
|
val project = file.project
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
|||||||
import org.jetbrains.kotlin.idea.core.getDeepestSuperDeclarations
|
import org.jetbrains.kotlin.idea.core.getDeepestSuperDeclarations
|
||||||
import org.jetbrains.kotlin.idea.core.getDirectlyOverriddenDeclarations
|
import org.jetbrains.kotlin.idea.core.getDirectlyOverriddenDeclarations
|
||||||
import org.jetbrains.kotlin.idea.highlighter.markers.headerImplementations
|
import org.jetbrains.kotlin.idea.highlighter.markers.headerImplementations
|
||||||
import org.jetbrains.kotlin.idea.highlighter.markers.isHeaderOrHeaderClassMember
|
import org.jetbrains.kotlin.idea.highlighter.markers.isExpectOrExpectClassMember
|
||||||
import org.jetbrains.kotlin.idea.highlighter.markers.liftToHeader
|
import org.jetbrains.kotlin.idea.highlighter.markers.liftToHeader
|
||||||
import org.jetbrains.kotlin.idea.util.getResolutionScope
|
import org.jetbrains.kotlin.idea.util.getResolutionScope
|
||||||
import org.jetbrains.kotlin.psi.KtBlockExpression
|
import org.jetbrains.kotlin.psi.KtBlockExpression
|
||||||
@@ -184,7 +184,7 @@ abstract class CallableRefactoring<out T: CallableDescriptor>(
|
|||||||
fun getAffectedCallables(project: Project, descriptorsForChange: Collection<CallableDescriptor>): List<PsiElement> {
|
fun getAffectedCallables(project: Project, descriptorsForChange: Collection<CallableDescriptor>): List<PsiElement> {
|
||||||
val baseCallables = descriptorsForChange.mapNotNull { DescriptorToSourceUtilsIde.getAnyDeclaration(project, it) }
|
val baseCallables = descriptorsForChange.mapNotNull { DescriptorToSourceUtilsIde.getAnyDeclaration(project, it) }
|
||||||
return baseCallables + baseCallables.flatMapTo(HashSet<PsiElement>()) { callable ->
|
return baseCallables + baseCallables.flatMapTo(HashSet<PsiElement>()) { callable ->
|
||||||
if (callable is KtDeclaration && callable.isHeaderOrHeaderClassMember()) {
|
if (callable is KtDeclaration && callable.isExpectOrExpectClassMember()) {
|
||||||
callable.headerImplementations()
|
callable.headerImplementations()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.descriptors.impl.AnonymousFunctionDescriptor
|
|||||||
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
|
import org.jetbrains.kotlin.idea.caches.resolve.unsafeResolveToDescriptor
|
||||||
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
import org.jetbrains.kotlin.idea.codeInsight.DescriptorToSourceUtilsIde
|
||||||
import org.jetbrains.kotlin.idea.highlighter.markers.headerImplementations
|
import org.jetbrains.kotlin.idea.highlighter.markers.headerImplementations
|
||||||
import org.jetbrains.kotlin.idea.highlighter.markers.isHeaderOrHeaderClassMember
|
import org.jetbrains.kotlin.idea.highlighter.markers.isExpectOrExpectClassMember
|
||||||
import org.jetbrains.kotlin.idea.refactoring.changeSignature.usages.KotlinCallableDefinitionUsage
|
import org.jetbrains.kotlin.idea.refactoring.changeSignature.usages.KotlinCallableDefinitionUsage
|
||||||
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
import org.jetbrains.kotlin.idea.util.IdeDescriptorRenderers
|
||||||
import org.jetbrains.kotlin.psi.*
|
import org.jetbrains.kotlin.psi.*
|
||||||
@@ -98,7 +98,7 @@ class KotlinChangeSignatureData(
|
|||||||
primaryCallables + primaryCallables.flatMapTo(HashSet<UsageInfo>()) { primaryFunction ->
|
primaryCallables + primaryCallables.flatMapTo(HashSet<UsageInfo>()) { primaryFunction ->
|
||||||
val primaryDeclaration = primaryFunction.declaration as? KtDeclaration ?: return@flatMapTo emptyList()
|
val primaryDeclaration = primaryFunction.declaration as? KtDeclaration ?: return@flatMapTo emptyList()
|
||||||
|
|
||||||
if (primaryDeclaration.isHeaderOrHeaderClassMember()) {
|
if (primaryDeclaration.isExpectOrExpectClassMember()) {
|
||||||
return@flatMapTo primaryDeclaration.headerImplementations().mapNotNull {
|
return@flatMapTo primaryDeclaration.headerImplementations().mapNotNull {
|
||||||
val descriptor = it.unsafeResolveToDescriptor()
|
val descriptor = it.unsafeResolveToDescriptor()
|
||||||
val callableDescriptor = when (descriptor) {
|
val callableDescriptor = when (descriptor) {
|
||||||
|
|||||||
+3
-3
@@ -69,7 +69,7 @@ class JsNameClashChecker : SimpleDeclarationChecker {
|
|||||||
if (existing != null &&
|
if (existing != null &&
|
||||||
existing != descriptor &&
|
existing != descriptor &&
|
||||||
existing.isImpl == descriptor.isImpl &&
|
existing.isImpl == descriptor.isImpl &&
|
||||||
existing.isHeader == descriptor.isHeader &&
|
existing.isExpect == descriptor.isExpect &&
|
||||||
!bindingContext.isCommonDiagnosticReported(declaration)
|
!bindingContext.isCommonDiagnosticReported(declaration)
|
||||||
) {
|
) {
|
||||||
diagnosticHolder.report(ErrorsJs.JS_NAME_CLASH.on(declaration, name, existing))
|
diagnosticHolder.report(ErrorsJs.JS_NAME_CLASH.on(declaration, name, existing))
|
||||||
@@ -112,8 +112,8 @@ class JsNameClashChecker : SimpleDeclarationChecker {
|
|||||||
private val DeclarationDescriptor.isImpl: Boolean
|
private val DeclarationDescriptor.isImpl: Boolean
|
||||||
get() = this is MemberDescriptor && this.isImpl
|
get() = this is MemberDescriptor && this.isImpl
|
||||||
|
|
||||||
private val DeclarationDescriptor.isHeader: Boolean
|
private val DeclarationDescriptor.isExpect: Boolean
|
||||||
get() = this is MemberDescriptor && this.isHeader
|
get() = this is MemberDescriptor && this.isExpect
|
||||||
|
|
||||||
private fun isFakeOverridingNative(descriptor: CallableMemberDescriptor): Boolean {
|
private fun isFakeOverridingNative(descriptor: CallableMemberDescriptor): Boolean {
|
||||||
return descriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE &&
|
return descriptor.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE &&
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ public final class AnnotationsUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPredefinedObject(@NotNull DeclarationDescriptor descriptor) {
|
public static boolean isPredefinedObject(@NotNull DeclarationDescriptor descriptor) {
|
||||||
if (descriptor instanceof MemberDescriptor && ((MemberDescriptor) descriptor).isHeader()) return true;
|
if (descriptor instanceof MemberDescriptor && ((MemberDescriptor) descriptor).isExpect()) return true;
|
||||||
if (isEffectivelyExternalMember(descriptor)) return true;
|
if (isEffectivelyExternalMember(descriptor)) return true;
|
||||||
|
|
||||||
for (PredefinedAnnotation annotation : PredefinedAnnotation.values()) {
|
for (PredefinedAnnotation annotation : PredefinedAnnotation.values()) {
|
||||||
|
|||||||
+1
-1
@@ -130,7 +130,7 @@ object KotlinJavascriptSerializationUtil {
|
|||||||
val builder = ProtoBuf.PackageFragment.newBuilder()
|
val builder = ProtoBuf.PackageFragment.newBuilder()
|
||||||
|
|
||||||
// TODO: ModuleDescriptor should be able to return the package only with the contents of that module, without dependencies
|
// TODO: ModuleDescriptor should be able to return the package only with the contents of that module, without dependencies
|
||||||
val skip: (DeclarationDescriptor) -> Boolean = { DescriptorUtils.getContainingModule(it) != module || (it is MemberDescriptor && it.isHeader) }
|
val skip: (DeclarationDescriptor) -> Boolean = { DescriptorUtils.getContainingModule(it) != module || (it is MemberDescriptor && it.isExpect) }
|
||||||
|
|
||||||
val fileRegistry = KotlinFileRegistry()
|
val fileRegistry = KotlinFileRegistry()
|
||||||
val serializerExtension = KotlinJavascriptSerializerExtension(fileRegistry)
|
val serializerExtension = KotlinJavascriptSerializerExtension(fileRegistry)
|
||||||
|
|||||||
+1
-1
@@ -104,7 +104,7 @@ private fun genProperty(
|
|||||||
sourceElement,
|
sourceElement,
|
||||||
/* lateInit = */ false,
|
/* lateInit = */ false,
|
||||||
/* isConst = */ false,
|
/* isConst = */ false,
|
||||||
/* isHeader = */ false,
|
/* isExpect = */ false,
|
||||||
/* isImpl = */ false,
|
/* isImpl = */ false,
|
||||||
/* isExternal = */ false,
|
/* isExternal = */ false,
|
||||||
/* isDelegated = */ false
|
/* isDelegated = */ false
|
||||||
|
|||||||
Reference in New Issue
Block a user