default -> companion: default object -> class object in project code, builtins and libs code
This commit is contained in:
@@ -39,7 +39,7 @@ public data open class AnalysisResult protected (
|
||||
|
||||
private class Error(bindingContext: BindingContext, val exception: Throwable) : AnalysisResult(bindingContext, ErrorUtils.getErrorModule())
|
||||
|
||||
default object {
|
||||
class object {
|
||||
public val EMPTY: AnalysisResult = success(BindingContext.EMPTY, ErrorUtils.getErrorModule())
|
||||
|
||||
platformStatic public fun success(bindingContext: BindingContext, module: ModuleDescriptor): AnalysisResult {
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ public class ReadValueInstruction private (
|
||||
override fun createCopy(): InstructionImpl =
|
||||
ReadValueInstruction(element, lexicalScope, target, receiverValues, outputValue)
|
||||
|
||||
default object Factory {
|
||||
class object Factory {
|
||||
public fun create (
|
||||
element: JetElement,
|
||||
lexicalScope: LexicalScope,
|
||||
|
||||
+3
-3
@@ -79,7 +79,7 @@ public class CallInstruction private(
|
||||
override fun toString() =
|
||||
renderInstruction("call", "${render(element)}, ${resolvedCall.getResultingDescriptor()!!.getName()}")
|
||||
|
||||
default object Factory {
|
||||
class object Factory {
|
||||
fun create (
|
||||
element: JetElement,
|
||||
lexicalScope: LexicalScope,
|
||||
@@ -115,7 +115,7 @@ public class MagicInstruction(
|
||||
|
||||
override fun toString() = renderInstruction("magic[$kind]", render(element))
|
||||
|
||||
default object Factory {
|
||||
class object Factory {
|
||||
fun create(
|
||||
element: JetElement,
|
||||
valueElement: JetElement?,
|
||||
@@ -165,7 +165,7 @@ class MergeInstruction private(
|
||||
|
||||
override fun toString() = renderInstruction("merge", render(element))
|
||||
|
||||
default object Factory {
|
||||
class object Factory {
|
||||
fun create(
|
||||
element: JetElement,
|
||||
lexicalScope: LexicalScope,
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.analyzer.ModuleInfo
|
||||
import org.jetbrains.kotlin.psi.JetFile
|
||||
|
||||
public trait ExternalDeclarationsProvider {
|
||||
default object : ProjectExtensionDescriptor<ExternalDeclarationsProvider>(
|
||||
class object : ProjectExtensionDescriptor<ExternalDeclarationsProvider>(
|
||||
"org.jetbrains.kotlin.externalDeclarationsProvider",
|
||||
javaClass<ExternalDeclarationsProvider>()
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ import kotlin.platform.*
|
||||
* Parses the contents of a Markdown link in KDoc. Uses the standard Kotlin lexer.
|
||||
*/
|
||||
class KDocLinkParser(): PsiParser {
|
||||
default object {
|
||||
class object {
|
||||
platformStatic public fun parseMarkdownLink(root: IElementType, chameleon: ASTNode): ASTNode {
|
||||
val parentElement = chameleon.getTreeParent().getPsi()
|
||||
val project = parentElement.getProject()
|
||||
|
||||
@@ -147,7 +147,7 @@ public abstract class JetCodeFragment(
|
||||
}
|
||||
}
|
||||
|
||||
default object {
|
||||
class object {
|
||||
public val IMPORT_SEPARATOR: String = ","
|
||||
public val RUNTIME_TYPE_EVALUATOR: Key<Function1<JetExpression, JetType?>> = Key.create("RUNTIME_TYPE_EVALUATOR")
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ abstract class JetSimpleNameExpressionImpl(node: ASTNode) : JetExpressionImpl(no
|
||||
override fun getReferencedName() = getReferencedNameImpl()
|
||||
|
||||
//NOTE: an unfortunate way to share an implementation between stubbed and not stubbed tree
|
||||
default object Helper {
|
||||
class object Helper {
|
||||
|
||||
fun JetSimpleNameExpression.getReferencedNameElementTypeImpl(): IElementType {
|
||||
return this.getReferencedNameElement().getNode()!!.getElementType()!!
|
||||
|
||||
@@ -73,7 +73,7 @@ public open class KotlinStubBaseImpl<T : JetElementImplStub<*>>(parent: StubElem
|
||||
return methodName
|
||||
}
|
||||
|
||||
default object {
|
||||
class object {
|
||||
private val LOGGER: Logger = Logger.getInstance(javaClass<KotlinStubBaseImpl<JetElementImplStub<*>>>())
|
||||
|
||||
private val BASE_STUB_INTERFACES = listOf(javaClass<KotlinStubWithFqName<*>>(), javaClass<KotlinClassOrObjectStub<*>>(), javaClass<NamedStub<*>>())
|
||||
|
||||
@@ -25,7 +25,7 @@ public trait CodeAnalyzerInitializer {
|
||||
public fun initialize(trace: BindingTrace, module: ModuleDescriptor, codeAnalyzer: KotlinCodeAnalyzer?)
|
||||
public fun createTrace(): BindingTrace
|
||||
|
||||
default object {
|
||||
class object {
|
||||
public fun getInstance(project: Project): CodeAnalyzerInitializer =
|
||||
ServiceManager.getService<CodeAnalyzerInitializer>(project, javaClass<CodeAnalyzerInitializer>())!!
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class CompositeBindingContext private (
|
||||
private val delegates: List<BindingContext>
|
||||
) : BindingContext {
|
||||
|
||||
default object {
|
||||
class object {
|
||||
public fun create(delegates: List<BindingContext>): BindingContext {
|
||||
if (delegates.isEmpty()) return BindingContext.EMPTY
|
||||
if (delegates.size() == 1) return delegates.first()
|
||||
|
||||
@@ -25,7 +25,7 @@ public open class StatementFilter {
|
||||
public open val filter: ((JetElement) -> Boolean)?
|
||||
get() = null
|
||||
|
||||
default object {
|
||||
class object {
|
||||
public val NONE: StatementFilter = StatementFilter()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ public class TypeResolver(
|
||||
return classifierDescriptor
|
||||
}
|
||||
|
||||
default object {
|
||||
class object {
|
||||
[platformStatic]
|
||||
public fun resolveProjectionKind(projectionKind: JetProjectionKind): Variance {
|
||||
return when (projectionKind) {
|
||||
|
||||
@@ -79,7 +79,7 @@ class VarianceChecker(private val trace: BindingTrace) {
|
||||
val occurrencePosition: Variance
|
||||
)
|
||||
|
||||
default object {
|
||||
class object {
|
||||
platformStatic fun recordPrivateToThisIfNeeded(trace: BindingTrace, descriptor: CallableMemberDescriptor) {
|
||||
if (isIrrelevant(descriptor) || descriptor.getVisibility() != Visibilities.PRIVATE) return
|
||||
|
||||
|
||||
+2
-2
@@ -47,8 +47,8 @@ public class CallableDescriptorCollectors<D : CallableDescriptor>(val collectors
|
||||
Iterable<CallableDescriptorCollector<D>> {
|
||||
override fun iterator(): Iterator<CallableDescriptorCollector<D>> = collectors.iterator()
|
||||
|
||||
[suppress("UNCHECKED_CAST")] default
|
||||
object {
|
||||
[suppress("UNCHECKED_CAST")]
|
||||
class object {
|
||||
public val FUNCTIONS_AND_VARIABLES: CallableDescriptorCollectors<CallableDescriptor> =
|
||||
CallableDescriptorCollectors(listOf(
|
||||
FUNCTIONS_COLLECTOR as CallableDescriptorCollector<CallableDescriptor>,
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import kotlin.platform.platformStatic
|
||||
|
||||
public class ConstantExpressionEvaluator private (val trace: BindingTrace) : JetVisitor<CompileTimeConstant<*>, JetType>() {
|
||||
|
||||
default object {
|
||||
class object {
|
||||
platformStatic public fun evaluate(expression: JetExpression, trace: BindingTrace, expectedType: JetType? = TypeUtils.NO_EXPECTED_TYPE): CompileTimeConstant<*>? {
|
||||
val evaluator = ConstantExpressionEvaluator(trace)
|
||||
return evaluator.evaluate(expression, expectedType)
|
||||
|
||||
@@ -36,7 +36,7 @@ public trait Diagnostics : Iterable<Diagnostic> {
|
||||
|
||||
override fun iterator() = all().iterator()
|
||||
|
||||
default object {
|
||||
class object {
|
||||
public val EMPTY: Diagnostics = object : Diagnostics {
|
||||
override fun noSuppression(): Diagnostics = this
|
||||
override val modificationTracker: ModificationTracker = ModificationTracker.NEVER_CHANGED
|
||||
|
||||
@@ -55,7 +55,7 @@ class LazyFileScope private(
|
||||
}
|
||||
}
|
||||
|
||||
default object Factory {
|
||||
class object Factory {
|
||||
public fun create(
|
||||
resolveSession: ResolveSession,
|
||||
file: JetFile,
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public abstract class DeclarationProviderFactoryService {
|
||||
filesScope: GlobalSearchScope
|
||||
): DeclarationProviderFactory
|
||||
|
||||
default object {
|
||||
class object {
|
||||
public platformStatic fun createDeclarationProviderFactory(
|
||||
project: Project,
|
||||
storageManager: StorageManager,
|
||||
|
||||
+1
-1
@@ -319,7 +319,7 @@ public open class LazyClassMemberScope(
|
||||
// Do not add details here, they may compromise the laziness during debugging
|
||||
override fun toString() = "lazy scope for class ${thisDescriptor.getName()}"
|
||||
|
||||
default object {
|
||||
class object {
|
||||
private val EXTRACT_FUNCTIONS: MemberExtractor<FunctionDescriptor> = object : MemberExtractor<FunctionDescriptor> {
|
||||
override fun extract(extractFrom: JetType, name: Name): Collection<FunctionDescriptor> {
|
||||
return extractFrom.getMemberScope().getFunctions(name)
|
||||
|
||||
Reference in New Issue
Block a user