Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
.kotlin.kotlin-compiler.1.3.11.source-code.IrClassImpl.kt Maven / Gradle / Ivy
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.ir.declarations.impl
import org.jetbrains.kotlin.descriptors.ClassDescriptor
import org.jetbrains.kotlin.descriptors.ClassKind
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibility
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.impl.IrClassSymbolImpl
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.util.transform
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyExternal
import org.jetbrains.kotlin.utils.SmartList
class IrClassImpl(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
override val symbol: IrClassSymbol,
override val name: Name,
override val kind: ClassKind,
override val visibility: Visibility,
override val modality: Modality,
override val isCompanion: Boolean,
override val isInner: Boolean,
override val isData: Boolean,
override val isExternal: Boolean,
override val isInline: Boolean
) :
IrDeclarationBase(startOffset, endOffset, origin),
IrClass {
constructor(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
symbol: IrClassSymbol
) :
this(
startOffset, endOffset, origin, symbol,
symbol.descriptor.name, symbol.descriptor.kind,
symbol.descriptor.visibility, symbol.descriptor.modality,
isCompanion = symbol.descriptor.isCompanionObject,
isInner = symbol.descriptor.isInner,
isData = symbol.descriptor.isData,
isExternal = symbol.descriptor.isEffectivelyExternal(),
isInline = symbol.descriptor.isInline
)
constructor(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
descriptor: ClassDescriptor
) :
this(startOffset, endOffset, origin, IrClassSymbolImpl(descriptor))
constructor(
startOffset: Int,
endOffset: Int,
origin: IrDeclarationOrigin,
descriptor: ClassDescriptor,
members: List
) : this(startOffset, endOffset, origin, descriptor) {
addAll(members)
}
init {
symbol.bind(this)
}
override val descriptor: ClassDescriptor get() = symbol.descriptor
override var thisReceiver: IrValueParameter? = null
override val declarations: MutableList = ArrayList()
override val typeParameters: MutableList = SmartList()
override val superTypes: MutableList = SmartList()
override fun accept(visitor: IrElementVisitor, data: D): R =
visitor.visitClass(this, data)
override fun acceptChildren(visitor: IrElementVisitor, data: D) {
thisReceiver?.accept(visitor, data)
typeParameters.forEach { it.accept(visitor, data) }
declarations.forEach { it.accept(visitor, data) }
}
override fun transformChildren(transformer: IrElementTransformer, data: D) {
thisReceiver = thisReceiver?.transform(transformer, data)
typeParameters.transform { it.transform(transformer, data) }
declarations.transform { it.transform(transformer, data) }
}
}