Move ir.tree.impl into ir.tree
This commit is contained in:
-49
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrAnonymousInitializer
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrAnonymousInitializerSymbol
|
||||
|
||||
class IrAnonymousInitializerImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrAnonymousInitializerSymbol,
|
||||
override val isStatic: Boolean = false,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrAnonymousInitializer() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ClassDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override lateinit var body: IrBlockBody
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* 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.*
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
open class IrClassImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
final override val symbol: IrClassSymbol,
|
||||
override var name: Name,
|
||||
override val kind: ClassKind,
|
||||
override var visibility: DescriptorVisibility,
|
||||
override var modality: Modality,
|
||||
override val isCompanion: Boolean = false,
|
||||
override var isInner: Boolean = false,
|
||||
override val isData: Boolean = false,
|
||||
override val isExternal: Boolean = false,
|
||||
override val isValue: Boolean = false,
|
||||
override val isExpect: Boolean = false,
|
||||
override val isFun: Boolean = false,
|
||||
override val source: SourceElement = SourceElement.NO_SOURCE,
|
||||
override val factory: IrFactory = IrFactoryImpl
|
||||
) : IrClass() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ClassDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override var thisReceiver: IrValueParameter? = null
|
||||
|
||||
override val declarations: MutableList<IrDeclaration> = ArrayList()
|
||||
|
||||
override var typeParameters: List<IrTypeParameter> = emptyList()
|
||||
|
||||
override var superTypes: List<IrType> = emptyList()
|
||||
|
||||
override var valueClassRepresentation: ValueClassRepresentation<IrSimpleType>? = null
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
|
||||
override var attributeOwnerId: IrAttributeContainer = this
|
||||
|
||||
override var sealedSubclasses: List<IrClassSymbol> = emptyList()
|
||||
}
|
||||
-75
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* 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.ClassConstructorDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
||||
import org.jetbrains.kotlin.ir.types.impl.ReturnTypeIsNotInitializedException
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
|
||||
class IrConstructorImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrConstructorSymbol,
|
||||
override var name: Name,
|
||||
override var visibility: DescriptorVisibility,
|
||||
returnType: IrType,
|
||||
override val isInline: Boolean,
|
||||
override val isExternal: Boolean,
|
||||
override val isPrimary: Boolean,
|
||||
override val isExpect: Boolean,
|
||||
override val containerSource: DeserializedContainerSource? = null,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrConstructor() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
override var returnType: IrType = returnType
|
||||
get() = if (field === IrUninitializedType) {
|
||||
throw ReturnTypeIsNotInitializedException(this)
|
||||
} else {
|
||||
field
|
||||
}
|
||||
|
||||
override var typeParameters: List<IrTypeParameter> = emptyList()
|
||||
|
||||
override var dispatchReceiverParameter: IrValueParameter? = null
|
||||
override var extensionReceiverParameter: IrValueParameter? = null
|
||||
override var contextReceiverParametersCount: Int = 0
|
||||
override var valueParameters: List<IrValueParameter> = emptyList()
|
||||
|
||||
override var body: IrBody? = null
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ClassConstructorDescriptor
|
||||
get() = symbol.descriptor
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* 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.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrEnumEntryImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrEnumEntrySymbol,
|
||||
override var name: Name,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrEnumEntry() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ClassDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override var correspondingClass: IrClass? = null
|
||||
override var initializerExpression: IrExpressionBody? = null
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* 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.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.declarations.IrErrorDeclaration
|
||||
import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
class IrErrorDeclarationImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
private val _descriptor: DeclarationDescriptor?,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrErrorDeclaration() {
|
||||
override val descriptor: DeclarationDescriptor
|
||||
get() = _descriptor ?: this.toIrBasedDescriptor()
|
||||
|
||||
override var origin: IrDeclarationOrigin = IrDeclarationOrigin.DEFINED
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
}
|
||||
-292
@@ -1,292 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.declarations.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
object IrFactoryImpl : AbstractIrFactoryImpl() {
|
||||
override val stageController: StageController = StageController()
|
||||
}
|
||||
|
||||
abstract class AbstractIrFactoryImpl : IrFactory {
|
||||
|
||||
override fun createAnonymousInitializer(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrAnonymousInitializerSymbol,
|
||||
isStatic: Boolean,
|
||||
): IrAnonymousInitializer =
|
||||
IrAnonymousInitializerImpl(startOffset, endOffset, origin, symbol, isStatic, factory = this)
|
||||
|
||||
override fun createClass(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrClassSymbol,
|
||||
name: Name,
|
||||
kind: ClassKind,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
isCompanion: Boolean,
|
||||
isInner: Boolean,
|
||||
isData: Boolean,
|
||||
isExternal: Boolean,
|
||||
isValue: Boolean,
|
||||
isExpect: Boolean,
|
||||
isFun: Boolean,
|
||||
source: SourceElement,
|
||||
): IrClass =
|
||||
IrClassImpl(
|
||||
startOffset, endOffset, origin, symbol, name, kind, visibility, modality,
|
||||
isCompanion, isInner, isData, isExternal, isValue, isExpect, isFun, source,
|
||||
factory = this
|
||||
)
|
||||
|
||||
override fun createConstructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrConstructorSymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isPrimary: Boolean,
|
||||
isExpect: Boolean,
|
||||
containerSource: DeserializedContainerSource?,
|
||||
): IrConstructor =
|
||||
IrConstructorImpl(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, returnType, isInline, isExternal, isPrimary, isExpect,
|
||||
containerSource, factory = this
|
||||
)
|
||||
|
||||
override fun createEnumEntry(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrEnumEntrySymbol,
|
||||
name: Name,
|
||||
): IrEnumEntry =
|
||||
IrEnumEntryImpl(startOffset, endOffset, origin, symbol, name, factory = this)
|
||||
|
||||
override fun createErrorDeclaration(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
descriptor: DeclarationDescriptor?,
|
||||
): IrErrorDeclaration =
|
||||
IrErrorDeclarationImpl(startOffset, endOffset, descriptor, factory = this)
|
||||
|
||||
override fun createField(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrFieldSymbol,
|
||||
name: Name,
|
||||
type: IrType,
|
||||
visibility: DescriptorVisibility,
|
||||
isFinal: Boolean,
|
||||
isExternal: Boolean,
|
||||
isStatic: Boolean,
|
||||
): IrField =
|
||||
IrFieldImpl(startOffset, endOffset, origin, symbol, name, type, visibility, isFinal, isExternal, isStatic, factory = this)
|
||||
|
||||
override fun createFunction(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrSimpleFunctionSymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isTailrec: Boolean,
|
||||
isSuspend: Boolean,
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
isFakeOverride: Boolean,
|
||||
containerSource: DeserializedContainerSource?,
|
||||
): IrSimpleFunction =
|
||||
IrFunctionImpl(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, modality, returnType,
|
||||
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect, isFakeOverride,
|
||||
containerSource, factory = this
|
||||
)
|
||||
|
||||
override fun createFakeOverrideFunction(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isTailrec: Boolean,
|
||||
isSuspend: Boolean,
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
): IrSimpleFunction =
|
||||
IrFakeOverrideFunctionImpl(
|
||||
startOffset, endOffset, origin, name, visibility, modality, returnType,
|
||||
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||
factory = this
|
||||
)
|
||||
|
||||
override fun createLocalDelegatedProperty(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrLocalDelegatedPropertySymbol,
|
||||
name: Name,
|
||||
type: IrType,
|
||||
isVar: Boolean,
|
||||
): IrLocalDelegatedProperty =
|
||||
IrLocalDelegatedPropertyImpl(startOffset, endOffset, origin, symbol, name, type, isVar, factory = this)
|
||||
|
||||
override fun createProperty(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrPropertySymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean,
|
||||
isFakeOverride: Boolean,
|
||||
containerSource: DeserializedContainerSource?,
|
||||
): IrProperty =
|
||||
IrPropertyImpl(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, modality,
|
||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect, isFakeOverride,
|
||||
containerSource, factory = this
|
||||
)
|
||||
|
||||
override fun createFakeOverrideProperty(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean,
|
||||
): IrProperty =
|
||||
IrFakeOverridePropertyImpl(
|
||||
startOffset, endOffset, origin, name, visibility, modality,
|
||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||
factory = this
|
||||
)
|
||||
|
||||
override fun createTypeAlias(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
symbol: IrTypeAliasSymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
expandedType: IrType,
|
||||
isActual: Boolean,
|
||||
origin: IrDeclarationOrigin,
|
||||
): IrTypeAlias =
|
||||
IrTypeAliasImpl(startOffset, endOffset, symbol, name, visibility, expandedType, isActual, origin, factory = this)
|
||||
|
||||
override fun createTypeParameter(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrTypeParameterSymbol,
|
||||
name: Name,
|
||||
index: Int,
|
||||
isReified: Boolean,
|
||||
variance: Variance,
|
||||
): IrTypeParameter =
|
||||
IrTypeParameterImpl(startOffset, endOffset, origin, symbol, name, index, isReified, variance, factory = this)
|
||||
|
||||
override fun createValueParameter(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrValueParameterSymbol,
|
||||
name: Name,
|
||||
index: Int,
|
||||
type: IrType,
|
||||
varargElementType: IrType?,
|
||||
isCrossinline: Boolean,
|
||||
isNoinline: Boolean,
|
||||
isHidden: Boolean,
|
||||
isAssignable: Boolean,
|
||||
): IrValueParameter =
|
||||
IrValueParameterImpl(
|
||||
startOffset, endOffset, origin, symbol, name, index, type, varargElementType,
|
||||
isCrossinline, isNoinline, isHidden, isAssignable, factory = this
|
||||
)
|
||||
|
||||
override fun createExpressionBody(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
initializer: IrExpressionBody.() -> Unit,
|
||||
): IrExpressionBody =
|
||||
IrExpressionBodyImpl(startOffset, endOffset, initializer)
|
||||
|
||||
override fun createExpressionBody(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
expression: IrExpression,
|
||||
): IrExpressionBody =
|
||||
IrExpressionBodyImpl(startOffset, endOffset, expression)
|
||||
|
||||
override fun createExpressionBody(
|
||||
expression: IrExpression,
|
||||
): IrExpressionBody =
|
||||
IrExpressionBodyImpl(expression)
|
||||
|
||||
override fun createBlockBody(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
): IrBlockBody =
|
||||
IrBlockBodyImpl(startOffset, endOffset)
|
||||
|
||||
override fun createBlockBody(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
statements: List<IrStatement>,
|
||||
): IrBlockBody =
|
||||
IrBlockBodyImpl(startOffset, endOffset, statements)
|
||||
|
||||
override fun createBlockBody(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
initializer: IrBlockBody.() -> Unit,
|
||||
): IrBlockBody =
|
||||
IrBlockBodyImpl(startOffset, endOffset, initializer)
|
||||
}
|
||||
-395
@@ -1,395 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.declarations.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.symbols.*
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.util.IdSignature
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
class IrFactoryImplForJsIC(override val stageController: StageController) : AbstractIrFactoryImpl(), IdSignatureRetriever {
|
||||
private val declarationToSignature = mutableMapOf<IrDeclaration, IdSignature>()
|
||||
|
||||
private fun <T : IrDeclaration> T.register(): T {
|
||||
val parentSig = stageController.currentDeclaration?.let { declarationSignature(it) } ?: return this
|
||||
|
||||
stageController.createSignature(parentSig)?.let { declarationToSignature[this] = it}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
override fun declarationSignature(declaration: IrDeclaration): IdSignature? {
|
||||
return declarationToSignature[declaration] ?: declaration.symbol.signature ?: declaration.symbol.privateSignature
|
||||
}
|
||||
|
||||
override fun createAnonymousInitializer(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrAnonymousInitializerSymbol,
|
||||
isStatic: Boolean
|
||||
): IrAnonymousInitializer {
|
||||
return super.createAnonymousInitializer(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
isStatic,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createClass(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrClassSymbol,
|
||||
name: Name,
|
||||
kind: ClassKind,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
isCompanion: Boolean,
|
||||
isInner: Boolean,
|
||||
isData: Boolean,
|
||||
isExternal: Boolean,
|
||||
isValue: Boolean,
|
||||
isExpect: Boolean,
|
||||
isFun: Boolean,
|
||||
source: SourceElement
|
||||
): IrClass {
|
||||
return super.createClass(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
kind,
|
||||
visibility,
|
||||
modality,
|
||||
isCompanion,
|
||||
isInner,
|
||||
isData,
|
||||
isExternal,
|
||||
isValue,
|
||||
isExpect,
|
||||
isFun,
|
||||
source,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createConstructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrConstructorSymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isPrimary: Boolean,
|
||||
isExpect: Boolean,
|
||||
containerSource: DeserializedContainerSource?
|
||||
): IrConstructor {
|
||||
return super.createConstructor(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
visibility,
|
||||
returnType,
|
||||
isInline,
|
||||
isExternal,
|
||||
isPrimary,
|
||||
isExpect,
|
||||
containerSource,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createEnumEntry(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrEnumEntrySymbol,
|
||||
name: Name
|
||||
): IrEnumEntry {
|
||||
return super.createEnumEntry(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createErrorDeclaration(startOffset: Int, endOffset: Int, descriptor: DeclarationDescriptor?): IrErrorDeclaration {
|
||||
return super.createErrorDeclaration(startOffset, endOffset, descriptor)
|
||||
}
|
||||
|
||||
override fun createField(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrFieldSymbol,
|
||||
name: Name,
|
||||
type: IrType,
|
||||
visibility: DescriptorVisibility,
|
||||
isFinal: Boolean,
|
||||
isExternal: Boolean,
|
||||
isStatic: Boolean
|
||||
): IrField {
|
||||
return super.createField(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
type,
|
||||
visibility,
|
||||
isFinal,
|
||||
isExternal,
|
||||
isStatic,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createFunction(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrSimpleFunctionSymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isTailrec: Boolean,
|
||||
isSuspend: Boolean,
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
isFakeOverride: Boolean,
|
||||
containerSource: DeserializedContainerSource?
|
||||
): IrSimpleFunction {
|
||||
return super.createFunction(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
visibility,
|
||||
modality,
|
||||
returnType,
|
||||
isInline,
|
||||
isExternal,
|
||||
isTailrec,
|
||||
isSuspend,
|
||||
isOperator,
|
||||
isInfix,
|
||||
isExpect,
|
||||
isFakeOverride,
|
||||
containerSource,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createFakeOverrideFunction(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isTailrec: Boolean,
|
||||
isSuspend: Boolean,
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean
|
||||
): IrSimpleFunction {
|
||||
return super.createFakeOverrideFunction(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
name,
|
||||
visibility,
|
||||
modality,
|
||||
returnType,
|
||||
isInline,
|
||||
isExternal,
|
||||
isTailrec,
|
||||
isSuspend,
|
||||
isOperator,
|
||||
isInfix,
|
||||
isExpect,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createLocalDelegatedProperty(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrLocalDelegatedPropertySymbol,
|
||||
name: Name,
|
||||
type: IrType,
|
||||
isVar: Boolean
|
||||
): IrLocalDelegatedProperty {
|
||||
return super.createLocalDelegatedProperty(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
type,
|
||||
isVar,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createProperty(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrPropertySymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean,
|
||||
isFakeOverride: Boolean,
|
||||
containerSource: DeserializedContainerSource?
|
||||
): IrProperty {
|
||||
return super.createProperty(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
visibility,
|
||||
modality,
|
||||
isVar,
|
||||
isConst,
|
||||
isLateinit,
|
||||
isDelegated,
|
||||
isExternal,
|
||||
isExpect,
|
||||
isFakeOverride,
|
||||
containerSource,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createFakeOverrideProperty(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
modality: Modality,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean
|
||||
): IrProperty {
|
||||
return super.createFakeOverrideProperty(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
name,
|
||||
visibility,
|
||||
modality,
|
||||
isVar,
|
||||
isConst,
|
||||
isLateinit,
|
||||
isDelegated,
|
||||
isExternal,
|
||||
isExpect,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createTypeAlias(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
symbol: IrTypeAliasSymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
expandedType: IrType,
|
||||
isActual: Boolean,
|
||||
origin: IrDeclarationOrigin
|
||||
): IrTypeAlias {
|
||||
return super.createTypeAlias(
|
||||
startOffset,
|
||||
endOffset,
|
||||
symbol,
|
||||
name,
|
||||
visibility,
|
||||
expandedType,
|
||||
isActual,
|
||||
origin,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createTypeParameter(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrTypeParameterSymbol,
|
||||
name: Name,
|
||||
index: Int,
|
||||
isReified: Boolean,
|
||||
variance: Variance
|
||||
): IrTypeParameter {
|
||||
return super.createTypeParameter(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
index,
|
||||
isReified,
|
||||
variance,
|
||||
).register()
|
||||
}
|
||||
|
||||
override fun createValueParameter(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrValueParameterSymbol,
|
||||
name: Name,
|
||||
index: Int,
|
||||
type: IrType,
|
||||
varargElementType: IrType?,
|
||||
isCrossinline: Boolean,
|
||||
isNoinline: Boolean,
|
||||
isHidden: Boolean,
|
||||
isAssignable: Boolean
|
||||
): IrValueParameter {
|
||||
return super.createValueParameter(
|
||||
startOffset,
|
||||
endOffset,
|
||||
origin,
|
||||
symbol,
|
||||
name,
|
||||
index,
|
||||
type,
|
||||
varargElementType,
|
||||
isCrossinline,
|
||||
isNoinline,
|
||||
isHidden,
|
||||
isAssignable,
|
||||
).register()
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* 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.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrFieldImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrFieldSymbol,
|
||||
override var name: Name,
|
||||
override var type: IrType,
|
||||
override var visibility: DescriptorVisibility,
|
||||
override val isFinal: Boolean,
|
||||
override val isExternal: Boolean,
|
||||
override val isStatic: Boolean,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrField() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: PropertyDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override var initializer: IrExpressionBody? = null
|
||||
|
||||
override var correspondingPropertySymbol: IrPropertySymbol? = null
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
}
|
||||
-147
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.declarations.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrUninitializedType
|
||||
import org.jetbrains.kotlin.ir.types.impl.ReturnTypeIsNotInitializedException
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
|
||||
abstract class IrFunctionCommonImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override var name: Name,
|
||||
override var visibility: DescriptorVisibility,
|
||||
returnType: IrType,
|
||||
override val isInline: Boolean,
|
||||
override val isExternal: Boolean,
|
||||
override val isTailrec: Boolean,
|
||||
override val isSuspend: Boolean,
|
||||
override val isOperator: Boolean,
|
||||
override val isInfix: Boolean,
|
||||
override val isExpect: Boolean,
|
||||
override val containerSource: DeserializedContainerSource?,
|
||||
) : IrSimpleFunction() {
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
override var returnType: IrType = returnType
|
||||
get() = if (field === IrUninitializedType) {
|
||||
throw ReturnTypeIsNotInitializedException(this)
|
||||
} else {
|
||||
field
|
||||
}
|
||||
|
||||
override var typeParameters: List<IrTypeParameter> = emptyList()
|
||||
|
||||
override var dispatchReceiverParameter: IrValueParameter? = null
|
||||
override var extensionReceiverParameter: IrValueParameter? = null
|
||||
override var valueParameters: List<IrValueParameter> = emptyList()
|
||||
|
||||
override var contextReceiverParametersCount: Int = 0
|
||||
|
||||
override var body: IrBody? = null
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
|
||||
override var overriddenSymbols: List<IrSimpleFunctionSymbol> = emptyList()
|
||||
|
||||
@Suppress("LeakingThis")
|
||||
override var attributeOwnerId: IrAttributeContainer = this
|
||||
|
||||
override var correspondingPropertySymbol: IrPropertySymbol? = null
|
||||
}
|
||||
|
||||
class IrFunctionImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrSimpleFunctionSymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
override val modality: Modality,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isTailrec: Boolean,
|
||||
isSuspend: Boolean,
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
containerSource: DeserializedContainerSource? = null,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrFunctionCommonImpl(
|
||||
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
||||
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||
containerSource,
|
||||
) {
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: FunctionDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
}
|
||||
|
||||
class IrFakeOverrideFunctionImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
override var modality: Modality,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isTailrec: Boolean,
|
||||
isSuspend: Boolean,
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrFunctionCommonImpl(
|
||||
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
||||
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||
containerSource = null,
|
||||
), IrFakeOverrideFunction {
|
||||
override val isFakeOverride: Boolean
|
||||
get() = true
|
||||
|
||||
private var _symbol: IrSimpleFunctionSymbol? = null
|
||||
|
||||
override val symbol: IrSimpleFunctionSymbol
|
||||
get() = _symbol ?: error("$this has not acquired a symbol yet")
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor
|
||||
get() = _symbol?.descriptor ?: this.toIrBasedDescriptor()
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
override fun acquireSymbol(symbol: IrSimpleFunctionSymbol): IrSimpleFunction {
|
||||
assert(_symbol == null) { "$this already has symbol _symbol" }
|
||||
_symbol = symbol
|
||||
symbol.bind(this)
|
||||
return this
|
||||
}
|
||||
|
||||
override val isBound: Boolean
|
||||
get() = _symbol != null
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.declarations.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.VariableDescriptorWithAccessors
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrLocalDelegatedPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrLocalDelegatedPropertyImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrLocalDelegatedPropertySymbol,
|
||||
override var name: Name,
|
||||
override var type: IrType,
|
||||
override val isVar: Boolean,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrLocalDelegatedProperty() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: VariableDescriptorWithAccessors
|
||||
get() = symbol.descriptor
|
||||
|
||||
override lateinit var delegate: IrVariable
|
||||
|
||||
override lateinit var getter: IrSimpleFunction
|
||||
|
||||
override var setter: IrSimpleFunction? = null
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
}
|
||||
-132
@@ -1,132 +0,0 @@
|
||||
/*
|
||||
* 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.Modality
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedContainerSource
|
||||
|
||||
abstract class IrPropertyCommonImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override var name: Name,
|
||||
override var visibility: DescriptorVisibility,
|
||||
override val isVar: Boolean,
|
||||
override val isConst: Boolean,
|
||||
override val isLateinit: Boolean,
|
||||
override val isDelegated: Boolean,
|
||||
override val isExternal: Boolean,
|
||||
override val isExpect: Boolean,
|
||||
override val containerSource: DeserializedContainerSource?,
|
||||
) : IrProperty() {
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
override var backingField: IrField? = null
|
||||
|
||||
override var getter: IrSimpleFunction? = null
|
||||
|
||||
override var setter: IrSimpleFunction? = null
|
||||
|
||||
override var overriddenSymbols: List<IrPropertySymbol> = emptyList()
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
|
||||
override var attributeOwnerId: IrAttributeContainer = this
|
||||
}
|
||||
|
||||
class IrPropertyImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrPropertySymbol,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
override val modality: Modality,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean = false,
|
||||
override val isFakeOverride: Boolean = origin == IrDeclarationOrigin.FAKE_OVERRIDE,
|
||||
containerSource: DeserializedContainerSource? = null,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrPropertyCommonImpl(
|
||||
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||
containerSource
|
||||
) {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: PropertyDescriptor
|
||||
get() = symbol.descriptor
|
||||
}
|
||||
|
||||
class IrFakeOverridePropertyImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: DescriptorVisibility,
|
||||
override var modality: Modality,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrPropertyCommonImpl(
|
||||
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||
containerSource = null,
|
||||
), IrFakeOverrideProperty {
|
||||
override val isFakeOverride: Boolean
|
||||
get() = true
|
||||
|
||||
private var _symbol: IrPropertySymbol? = null
|
||||
|
||||
override val symbol: IrPropertySymbol
|
||||
get() = _symbol ?: error("$this has not acquired a symbol yet")
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor
|
||||
get() = _symbol?.descriptor ?: this.toIrBasedDescriptor()
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
override fun acquireSymbol(symbol: IrPropertySymbol): IrProperty {
|
||||
assert(_symbol == null) { "$this already has symbol _symbol" }
|
||||
_symbol = symbol
|
||||
symbol.bind(this)
|
||||
return this
|
||||
}
|
||||
|
||||
override val isBound: Boolean
|
||||
get() = _symbol != null
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.ir.declarations.impl
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibility
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrTypeAliasImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override val symbol: IrTypeAliasSymbol,
|
||||
override var name: Name,
|
||||
override var visibility: DescriptorVisibility,
|
||||
override var expandedType: IrType,
|
||||
override val isActual: Boolean,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrTypeAlias() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: TypeAliasDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override var typeParameters: List<IrTypeParameter> = emptyList()
|
||||
}
|
||||
-54
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
class IrTypeParameterImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrTypeParameterSymbol,
|
||||
override var name: Name,
|
||||
override val index: Int,
|
||||
override val isReified: Boolean,
|
||||
override val variance: Variance,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrTypeParameter() {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: TypeParameterDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override var superTypes: List<IrType> = emptyList()
|
||||
}
|
||||
-58
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.ParameterDescriptor
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationParent
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueParameter
|
||||
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
import org.jetbrains.kotlin.ir.symbols.IrValueParameterSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrValueParameterImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin,
|
||||
override val symbol: IrValueParameterSymbol,
|
||||
override var name: Name,
|
||||
override val index: Int,
|
||||
override var type: IrType,
|
||||
override var varargElementType: IrType?,
|
||||
override val isCrossinline: Boolean,
|
||||
override val isNoinline: Boolean,
|
||||
override val isHidden: Boolean,
|
||||
override val isAssignable: Boolean,
|
||||
override val factory: IrFactory = IrFactoryImpl,
|
||||
) : IrValueParameter() {
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ParameterDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override lateinit var parent: IrDeclarationParent
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
|
||||
override var defaultValue: IrExpressionBody? = null
|
||||
}
|
||||
-40
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
||||
|
||||
class IrBlockBodyImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int
|
||||
) : IrBlockBody() {
|
||||
constructor(startOffset: Int, endOffset: Int, statements: List<IrStatement>) : this(startOffset, endOffset) {
|
||||
this.statements.addAll(statements)
|
||||
}
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, initializer: IrBlockBody.() -> Unit) : this(startOffset, endOffset) {
|
||||
this.initializer()
|
||||
}
|
||||
|
||||
override val statements: MutableList<IrStatement> = ArrayList()
|
||||
|
||||
override val factory: IrFactory
|
||||
get() = IrFactoryImpl
|
||||
}
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* 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.expressions.impl
|
||||
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFactory
|
||||
import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
|
||||
class IrExpressionBodyImpl(
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
initializer: (IrExpressionBody.() -> Unit)? = null
|
||||
) : IrExpressionBody() {
|
||||
init {
|
||||
initializer?.invoke(this)
|
||||
}
|
||||
|
||||
constructor(startOffset: Int, endOffset: Int, expression: IrExpression) : this(startOffset, endOffset) {
|
||||
this.expression = expression
|
||||
}
|
||||
|
||||
constructor(expression: IrExpression) : this(expression.startOffset, expression.endOffset, expression)
|
||||
|
||||
override lateinit var expression: IrExpression
|
||||
|
||||
override val factory: IrFactory
|
||||
get() = IrFactoryImpl
|
||||
}
|
||||
Reference in New Issue
Block a user