IR: add module ir.tree.impl, move main IR implementation there
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile(project(":compiler:ir.tree"))
|
||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBlockBody
|
||||
import org.jetbrains.kotlin.ir.symbols.IrAnonymousInitializerSymbol
|
||||
|
||||
class IrAnonymousInitializerImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrAnonymousInitializerSymbol,
|
||||
override val isStatic: Boolean = false
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrAnonymousInitializer {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ClassDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override lateinit var body: IrBlockBody
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrClassImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrClassSymbol,
|
||||
override val name: Name,
|
||||
override val kind: ClassKind,
|
||||
override var visibility: Visibility,
|
||||
override var modality: Modality,
|
||||
override val isCompanion: Boolean = false,
|
||||
override val isInner: Boolean = false,
|
||||
override val isData: Boolean = false,
|
||||
override val isExternal: Boolean = false,
|
||||
override val isInline: Boolean = false,
|
||||
override val isExpect: Boolean = false,
|
||||
override val isFun: Boolean = false,
|
||||
override val source: SourceElement = SourceElement.NO_SOURCE
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrClass {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@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 metadata: MetadataSource? = null
|
||||
|
||||
override var attributeOwnerId: IrAttributeContainer = this
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.Visibility
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrConstructor
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrConstructorImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrConstructorSymbol,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
override val isPrimary: Boolean,
|
||||
isExpect: Boolean
|
||||
) : IrFunctionBase(startOffset, endOffset, origin, name, visibility, isInline, isExternal, isExpect, returnType), IrConstructor {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ClassConstructorDescriptor
|
||||
get() = symbol.descriptor
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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.ir.IrElementBase
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclaration
|
||||
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.expressions.IrConstructorCall
|
||||
|
||||
abstract class IrDeclarationBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
override var origin: IrDeclarationOrigin
|
||||
) : IrElementBase(startOffset, endOffset), IrDeclaration {
|
||||
override val factory: IrFactory
|
||||
get() = IrFactoryImpl
|
||||
|
||||
private var _parent: IrDeclarationParent? = null
|
||||
override var parent: IrDeclarationParent
|
||||
get() = _parent
|
||||
?: throw UninitializedPropertyAccessException("Parent not initialized: $this")
|
||||
set(v) {
|
||||
_parent = v
|
||||
}
|
||||
|
||||
override var annotations: List<IrConstructorCall> = emptyList()
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpressionBody
|
||||
import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrEnumEntryImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrEnumEntrySymbol,
|
||||
override val name: Name
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrEnumEntry {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ClassDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override var correspondingClass: IrClass? = null
|
||||
override var initializerExpression: IrExpressionBody? = null
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrErrorDeclaration
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
class IrErrorDeclarationImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
override val descriptor: DeclarationDescriptor
|
||||
) : IrDeclarationBase(startOffset, endOffset, IrDeclarationOrigin.DEFINED), IrErrorDeclaration
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
/*
|
||||
* 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.types.Variance
|
||||
|
||||
object IrFactoryImpl : IrFactory {
|
||||
override fun createAnonymousInitializer(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrAnonymousInitializerSymbol,
|
||||
isStatic: Boolean,
|
||||
): IrAnonymousInitializer =
|
||||
IrAnonymousInitializerImpl(startOffset, endOffset, origin, symbol, isStatic)
|
||||
|
||||
override fun createClass(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrClassSymbol,
|
||||
name: Name,
|
||||
kind: ClassKind,
|
||||
visibility: Visibility,
|
||||
modality: Modality,
|
||||
isCompanion: Boolean,
|
||||
isInner: Boolean,
|
||||
isData: Boolean,
|
||||
isExternal: Boolean,
|
||||
isInline: Boolean,
|
||||
isExpect: Boolean,
|
||||
isFun: Boolean,
|
||||
source: SourceElement,
|
||||
): IrClass =
|
||||
IrClassImpl(
|
||||
startOffset, endOffset, origin, symbol, name, kind, visibility, modality,
|
||||
isCompanion, isInner, isData, isExternal, isInline, isExpect, isFun, source,
|
||||
)
|
||||
|
||||
override fun createConstructor(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrConstructorSymbol,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isPrimary: Boolean,
|
||||
isExpect: Boolean,
|
||||
): IrConstructor =
|
||||
IrConstructorImpl(startOffset, endOffset, origin, symbol, name, visibility, returnType, isInline, isExternal, isPrimary, isExpect)
|
||||
|
||||
override fun createEnumEntry(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrEnumEntrySymbol,
|
||||
name: Name,
|
||||
): IrEnumEntry =
|
||||
IrEnumEntryImpl(startOffset, endOffset, origin, symbol, name)
|
||||
|
||||
override fun createErrorDeclaration(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
descriptor: DeclarationDescriptor,
|
||||
): IrErrorDeclaration =
|
||||
IrErrorDeclarationImpl(startOffset, endOffset, descriptor)
|
||||
|
||||
override fun createField(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrFieldSymbol,
|
||||
name: Name,
|
||||
type: IrType,
|
||||
visibility: Visibility,
|
||||
isFinal: Boolean,
|
||||
isExternal: Boolean,
|
||||
isStatic: Boolean,
|
||||
): IrField =
|
||||
IrFieldImpl(startOffset, endOffset, origin, symbol, name, type, visibility, isFinal, isExternal, isStatic)
|
||||
|
||||
override fun createFunction(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrSimpleFunctionSymbol,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
modality: Modality,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isTailrec: Boolean,
|
||||
isSuspend: Boolean,
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
isFakeOverride: Boolean,
|
||||
): IrSimpleFunction =
|
||||
IrFunctionImpl(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, modality, returnType,
|
||||
isInline, isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect, isFakeOverride,
|
||||
)
|
||||
|
||||
override fun createFakeOverrideFunction(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
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,
|
||||
)
|
||||
|
||||
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)
|
||||
|
||||
override fun createProperty(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrPropertySymbol,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
modality: Modality,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean,
|
||||
isFakeOverride: Boolean,
|
||||
): IrProperty =
|
||||
IrPropertyImpl(
|
||||
startOffset, endOffset, origin, symbol, name, visibility, modality,
|
||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect, isFakeOverride,
|
||||
)
|
||||
|
||||
override fun createFakeOverrideProperty(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
modality: Modality,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean,
|
||||
): IrFakeOverrideProperty =
|
||||
IrFakeOverridePropertyImpl(
|
||||
startOffset, endOffset, origin, name, visibility, modality,
|
||||
isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||
)
|
||||
|
||||
override fun createTypeAlias(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
symbol: IrTypeAliasSymbol,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
expandedType: IrType,
|
||||
isActual: Boolean,
|
||||
origin: IrDeclarationOrigin,
|
||||
): IrTypeAlias =
|
||||
IrTypeAliasImpl(startOffset, endOffset, symbol, name, visibility, expandedType, isActual, origin)
|
||||
|
||||
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)
|
||||
|
||||
override fun createValueParameter(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
symbol: IrValueParameterSymbol,
|
||||
name: Name,
|
||||
index: Int,
|
||||
type: IrType,
|
||||
varargElementType: IrType?,
|
||||
isCrossinline: Boolean,
|
||||
isNoinline: Boolean,
|
||||
): IrValueParameter =
|
||||
IrValueParameterImpl(startOffset, endOffset, origin, symbol, name, index, type, varargElementType, isCrossinline, isNoinline)
|
||||
|
||||
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)
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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.Visibility
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrField
|
||||
import org.jetbrains.kotlin.ir.declarations.MetadataSource
|
||||
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(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrFieldSymbol,
|
||||
override val name: Name,
|
||||
override val type: IrType,
|
||||
override var visibility: Visibility,
|
||||
override val isFinal: Boolean,
|
||||
override val isExternal: Boolean,
|
||||
override val isStatic: Boolean,
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrField {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: PropertyDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override var initializer: IrExpressionBody? = null
|
||||
|
||||
override var correspondingPropertySymbol: IrPropertySymbol? = null
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.Visibility
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrBody
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
abstract class IrFunctionBase(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val name: Name,
|
||||
override var visibility: Visibility,
|
||||
override val isInline: Boolean,
|
||||
override val isExternal: Boolean,
|
||||
override val isExpect: Boolean,
|
||||
returnType: IrType
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrFunction {
|
||||
@Suppress("DEPRECATION")
|
||||
final override var returnType: IrType = returnType
|
||||
get() = if (field === org.jetbrains.kotlin.ir.types.impl.IrUninitializedType) {
|
||||
error("Return type is not initialized")
|
||||
} else {
|
||||
field
|
||||
}
|
||||
|
||||
override var typeParameters: List<IrTypeParameter> = emptyList()
|
||||
|
||||
override var dispatchReceiverParameter: IrValueParameter? = null
|
||||
override var extensionReceiverParameter: IrValueParameter? = null
|
||||
override var valueParameters: List<IrValueParameter> = emptyList()
|
||||
|
||||
final override var body: IrBody? = null
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* 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.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.Modality
|
||||
import org.jetbrains.kotlin.descriptors.Visibility
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFakeOverrideFunction
|
||||
import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction
|
||||
import org.jetbrains.kotlin.ir.descriptors.WrappedSimpleFunctionDescriptor
|
||||
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.name.Name
|
||||
|
||||
abstract class IrFunctionCommonImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
override val isTailrec: Boolean,
|
||||
override val isSuspend: Boolean,
|
||||
override val isOperator: Boolean,
|
||||
override val isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
) : IrFunctionBase(startOffset, endOffset, origin, name, visibility, isInline, isExternal, isExpect, returnType), IrSimpleFunction {
|
||||
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: Visibility,
|
||||
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,
|
||||
) : IrFunctionCommonImpl(
|
||||
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
||||
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||
) {
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: FunctionDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
}
|
||||
|
||||
class IrFakeOverrideFunctionImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
override var visibility: Visibility,
|
||||
override var modality: Modality,
|
||||
returnType: IrType,
|
||||
isInline: Boolean,
|
||||
isExternal: Boolean,
|
||||
isTailrec: Boolean,
|
||||
isSuspend: Boolean,
|
||||
isOperator: Boolean,
|
||||
isInfix: Boolean,
|
||||
isExpect: Boolean,
|
||||
) : IrFunctionCommonImpl(
|
||||
startOffset, endOffset, origin, name, visibility, returnType, isInline,
|
||||
isExternal, isTailrec, isSuspend, isOperator, isInfix, isExpect,
|
||||
), 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 ?: WrappedSimpleFunctionDescriptor()
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
override fun acquireSymbol(symbol: IrSimpleFunctionSymbol) {
|
||||
assert(_symbol == null) { "$this already has symbol _symbol" }
|
||||
_symbol = symbol
|
||||
symbol.bind(this)
|
||||
(symbol.descriptor as? WrappedSimpleFunctionDescriptor)?.bind(this)
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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.VariableDescriptorWithAccessors
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrLocalDelegatedPropertySymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrLocalDelegatedPropertyImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrLocalDelegatedPropertySymbol,
|
||||
override val name: Name,
|
||||
override val type: IrType,
|
||||
override val isVar: Boolean
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrLocalDelegatedProperty {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: VariableDescriptorWithAccessors
|
||||
get() = symbol.descriptor
|
||||
|
||||
override lateinit var delegate: IrVariable
|
||||
|
||||
override lateinit var getter: IrFunction
|
||||
|
||||
override var setter: IrFunction? = null
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* 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.Visibility
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
import org.jetbrains.kotlin.ir.descriptors.WrappedPropertyDescriptor
|
||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
abstract class IrPropertyCommonImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val name: Name,
|
||||
override var visibility: Visibility,
|
||||
override val isVar: Boolean,
|
||||
override val isConst: Boolean,
|
||||
override val isLateinit: Boolean,
|
||||
override val isDelegated: Boolean,
|
||||
override val isExternal: Boolean,
|
||||
override val isExpect: Boolean,
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrProperty {
|
||||
override var backingField: IrField? = null
|
||||
|
||||
override var getter: IrSimpleFunction? = null
|
||||
|
||||
override var setter: IrSimpleFunction? = null
|
||||
|
||||
override var metadata: MetadataSource? = null
|
||||
}
|
||||
|
||||
class IrPropertyImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrPropertySymbol,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
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,
|
||||
) : IrPropertyCommonImpl(
|
||||
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||
) {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: PropertyDescriptor
|
||||
get() = symbol.descriptor
|
||||
}
|
||||
|
||||
class IrFakeOverridePropertyImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
name: Name,
|
||||
visibility: Visibility,
|
||||
override var modality: Modality,
|
||||
isVar: Boolean,
|
||||
isConst: Boolean,
|
||||
isLateinit: Boolean,
|
||||
isDelegated: Boolean,
|
||||
isExternal: Boolean,
|
||||
isExpect: Boolean,
|
||||
) : IrPropertyCommonImpl(
|
||||
startOffset, endOffset, origin, name, visibility, isVar, isConst, isLateinit, isDelegated, isExternal, isExpect,
|
||||
), 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 ?: WrappedPropertyDescriptor()
|
||||
|
||||
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||
override fun acquireSymbol(symbol: IrPropertySymbol) {
|
||||
assert(_symbol == null) { "$this already has symbol _symbol" }
|
||||
_symbol = symbol
|
||||
symbol.bind(this)
|
||||
(symbol.descriptor as? WrappedPropertyDescriptor)?.bind(this)
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.Visibility
|
||||
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
|
||||
import org.jetbrains.kotlin.ir.declarations.IrTypeAlias
|
||||
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
|
||||
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
class IrTypeAliasImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
override val symbol: IrTypeAliasSymbol,
|
||||
override val name: Name,
|
||||
override var visibility: Visibility,
|
||||
override val expandedType: IrType,
|
||||
override val isActual: Boolean,
|
||||
origin: IrDeclarationOrigin
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrTypeAlias {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: TypeAliasDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override var typeParameters: List<IrTypeParameter> = emptyList()
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.IrTypeParameter
|
||||
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
|
||||
import org.jetbrains.kotlin.utils.SmartList
|
||||
|
||||
class IrTypeParameterImpl(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrTypeParameterSymbol,
|
||||
override val name: Name,
|
||||
override val index: Int,
|
||||
override val isReified: Boolean,
|
||||
override val variance: Variance
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrTypeParameter {
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: TypeParameterDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
override val superTypes: MutableList<IrType> = SmartList()
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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.IrValueParameter
|
||||
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(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
origin: IrDeclarationOrigin,
|
||||
override val symbol: IrValueParameterSymbol,
|
||||
override val name: Name,
|
||||
override val index: Int,
|
||||
override val type: IrType,
|
||||
override val varargElementType: IrType?,
|
||||
override val isCrossinline: Boolean,
|
||||
override val isNoinline: Boolean
|
||||
) : IrDeclarationBase(startOffset, endOffset, origin), IrValueParameter {
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override val descriptor: ParameterDescriptor
|
||||
get() = symbol.descriptor
|
||||
|
||||
init {
|
||||
symbol.bind(this)
|
||||
}
|
||||
|
||||
override var defaultValue: IrExpressionBody? = null
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.IrElementBase
|
||||
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(startOffset: Int, endOffset: Int) : IrElementBase(startOffset, endOffset), 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
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.IrElementBase
|
||||
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(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
initializer: (IrExpressionBody.() -> Unit)? = null
|
||||
) : IrElementBase(startOffset, endOffset), 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