JS: refactor generation of functions with optional parameters. Fix #KT-7302, #KT-13888
This commit is contained in:
@@ -125,7 +125,7 @@ val DeclarationDescriptorWithVisibility.isEffectivelyPrivateApi: Boolean
|
||||
|
||||
val DeclarationDescriptor.isInsidePrivateClass: Boolean
|
||||
get() {
|
||||
var parent = containingDeclaration as? ClassDescriptor
|
||||
val parent = containingDeclaration as? ClassDescriptor
|
||||
return parent != null && Visibilities.isPrivate(parent.visibility)
|
||||
}
|
||||
|
||||
@@ -197,6 +197,14 @@ fun ValueParameterDescriptor.hasDefaultValue(): Boolean {
|
||||
)
|
||||
}
|
||||
|
||||
fun FunctionDescriptor.hasOrInheritsParametersWithDefaultValue(): Boolean = DFS.ifAny(
|
||||
listOf(this),
|
||||
{ current -> current.overriddenDescriptors.map { it.original } },
|
||||
{ it.hasOwnParametersWithDefaultValue() }
|
||||
)
|
||||
|
||||
fun FunctionDescriptor.hasOwnParametersWithDefaultValue() = original.valueParameters.any { it.declaresDefaultValue() }
|
||||
|
||||
fun Annotated.isRepeatableAnnotation(): Boolean =
|
||||
annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.repeatable) != null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user