diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBlockBodyImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBlockBodyImpl.kt index 38ebf5dc25c..f0baf6210e9 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBlockBodyImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBlockBodyImpl.kt @@ -9,9 +9,9 @@ import org.jetbrains.kotlin.ir.IrImplementationDetail import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.expressions.IrBlockBody -class IrBlockBodyImpl @IrImplementationDetail constructor( +class IrBlockBodyImpl @IrImplementationDetail internal constructor( override val startOffset: Int, - override val endOffset: Int + override val endOffset: Int, ) : IrBlockBody() { override val statements: MutableList = ArrayList(2) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBlockImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBlockImpl.kt index a59c196dfab..fdf58247096 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBlockImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBlockImpl.kt @@ -1,46 +1,58 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer -import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.expressions.IrBlock +import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrBlockImpl( +class IrBlockImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - override var origin: IrStatementOrigin? = null, + override var origin: IrStatementOrigin?, ) : IrBlock() { override val statements: MutableList = ArrayList(2) override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null +} - constructor( - startOffset: Int, - endOffset: Int, - type: IrType, - origin: IrStatementOrigin?, - statements: List - ) : this(startOffset, endOffset, type, origin) { - this.statements.addAll(statements) - } +fun IrBlockImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + origin: IrStatementOrigin? = null, +) = IrBlockImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + origin = origin, +) + +fun IrBlockImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + origin: IrStatementOrigin? = null, + statements: List, +) = IrBlockImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + origin = origin, +).apply { + this.statements.addAll(statements) } fun IrBlockImpl.addIfNotNull(statement: IrStatement?) { diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBranchImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBranchImpl.kt index 494014e9a46..15868950e44 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBranchImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBranchImpl.kt @@ -7,13 +7,37 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.ir.expressions.IrBranch import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -open class IrBranchImpl( +open class IrBranchImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var condition: IrExpression, - override var result: IrExpression -) : IrBranch() { - constructor(condition: IrExpression, result: IrExpression) : - this(condition.startOffset, result.endOffset, condition, result) -} \ No newline at end of file + override var result: IrExpression, +) : IrBranch() + +fun IrBranchImpl( + startOffset: Int, + endOffset: Int, + condition: IrExpression, + result: IrExpression, +) = IrBranchImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + condition = condition, + result = result, +) + +fun IrBranchImpl( + condition: IrExpression, + result: IrExpression, +) = IrBranchImpl( + constructorIndicator = null, + startOffset = condition.startOffset, + endOffset = result.endOffset, + condition = condition, + result = result, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBreakImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBreakImpl.kt index df110619604..6acfc00e1f7 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBreakImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrBreakImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,8 +9,11 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrBreak import org.jetbrains.kotlin.ir.expressions.IrLoop import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrBreakImpl( +class IrBreakImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -32,3 +24,16 @@ class IrBreakImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrBreakImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + loop: IrLoop, +) = IrBreakImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + loop = loop, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCatchImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCatchImpl.kt index 737371c407c..df7abae940b 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCatchImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCatchImpl.kt @@ -8,20 +8,39 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.IrCatch import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrCatchImpl( +class IrCatchImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var catchParameter: IrVariable, ) : IrCatch() { - constructor( - startOffset: Int, - endOffset: Int, - catchParameter: IrVariable, - result: IrExpression - ) : this(startOffset, endOffset, catchParameter) { - this.result = result - } - override lateinit var result: IrExpression -} \ No newline at end of file +} + +fun IrCatchImpl( + startOffset: Int, + endOffset: Int, + catchParameter: IrVariable, +) = IrCatchImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + catchParameter = catchParameter, +) + +fun IrCatchImpl( + startOffset: Int, + endOffset: Int, + catchParameter: IrVariable, + result: IrExpression, +) = IrCatchImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + catchParameter = catchParameter, +).apply { + this.result = result +} diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrClassReferenceImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrClassReferenceImpl.kt index b215ee7c526..fbf6dca4f7f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrClassReferenceImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrClassReferenceImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,14 +9,32 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrClassReference import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrClassReferenceImpl( +class IrClassReferenceImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var symbol: IrClassifierSymbol, - override var classType: IrType + override var classType: IrType, ) : IrClassReference() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrClassReferenceImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + symbol: IrClassifierSymbol, + classType: IrType, +) = IrClassReferenceImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + symbol = symbol, + classType = classType, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCompositeImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCompositeImpl.kt index 6ab57cc3a9e..4ac3d4ab9e6 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCompositeImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrCompositeImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -21,25 +10,47 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrComposite import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrCompositeImpl( +class IrCompositeImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - override var origin: IrStatementOrigin? = null, + override var origin: IrStatementOrigin?, ) : IrComposite() { override val statements: MutableList = ArrayList(2) override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null - - constructor( - startOffset: Int, - endOffset: Int, - type: IrType, - origin: IrStatementOrigin?, - statements: List - ) : this(startOffset, endOffset, type, origin) { - this.statements.addAll(statements) - } +} + +fun IrCompositeImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + origin: IrStatementOrigin? = null, +) = IrCompositeImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + origin = origin, +) + +fun IrCompositeImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + origin: IrStatementOrigin?, + statements: List, +) = IrCompositeImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + origin = origin, +).apply { + this.statements.addAll(statements) } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstImpl.kt index 7c9a8aa247a..81cc90b91bd 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -24,13 +13,16 @@ import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.getPrimitiveType import org.jetbrains.kotlin.ir.types.isMarkedNullable import org.jetbrains.kotlin.ir.types.makeNullable +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrConstImpl( +class IrConstImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var kind: IrConstKind, - override var value: T + override var value: T, ) : IrConst() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null @@ -91,3 +83,18 @@ class IrConstImpl( fun IrConst.copyWithOffsets(startOffset: Int, endOffset: Int) = IrConstImpl(startOffset, endOffset, type, kind, value) + +fun IrConstImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + kind: IrConstKind, + value: T, +) = IrConstImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + kind = kind, + value = value, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantArrayImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantArrayImpl.kt index 67c0a0558ae..09d11ff4270 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantArrayImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantArrayImpl.kt @@ -9,16 +9,32 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrConstantArray import org.jetbrains.kotlin.ir.expressions.IrConstantValue import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator import org.jetbrains.kotlin.utils.SmartList -class IrConstantArrayImpl( +class IrConstantArrayImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - initElements: List, ) : IrConstantArray() { - override val elements = SmartList(initElements) + override val elements = SmartList() override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null +} + +fun IrConstantArrayImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + initElements: List, +) = IrConstantArrayImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, +).apply { + elements.addAll(initElements) } \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantObjectImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantObjectImpl.kt index e95381adb86..d29fb6ef6fe 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantObjectImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantObjectImpl.kt @@ -10,20 +10,39 @@ import org.jetbrains.kotlin.ir.expressions.IrConstantObject import org.jetbrains.kotlin.ir.expressions.IrConstantValue import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator import org.jetbrains.kotlin.ir.util.constructedClassType import org.jetbrains.kotlin.utils.SmartList -class IrConstantObjectImpl( +class IrConstantObjectImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var constructor: IrConstructorSymbol, - initValueArguments: List, - initTypeArguments: List, - override var type: IrType = constructor.owner.constructedClassType, + override var type: IrType, ) : IrConstantObject() { - override val valueArguments = SmartList(initValueArguments) - override val typeArguments = SmartList(initTypeArguments) + override val valueArguments = SmartList() + override val typeArguments = SmartList() override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrConstantObjectImpl( + startOffset: Int, + endOffset: Int, + constructor: IrConstructorSymbol, + initValueArguments: List, + initTypeArguments: List, + type: IrType = constructor.owner.constructedClassType, +) = IrConstantObjectImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + constructor = constructor, + type = type, +).apply { + valueArguments.addAll(initValueArguments) + typeArguments.addAll(initTypeArguments) +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantPrimitiveImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantPrimitiveImpl.kt index b07fa30b267..d19ba2e5c11 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantPrimitiveImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrConstantPrimitiveImpl.kt @@ -8,8 +8,11 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrConst import org.jetbrains.kotlin.ir.expressions.IrConstantPrimitive +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrConstantPrimitiveImpl( +class IrConstantPrimitiveImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var value: IrConst<*>, @@ -17,4 +20,15 @@ class IrConstantPrimitiveImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null override var type = value.type -} \ No newline at end of file +} + +fun IrConstantPrimitiveImpl( + startOffset: Int, + endOffset: Int, + value: IrConst<*>, +) = IrConstantPrimitiveImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + value = value, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrContinueImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrContinueImpl.kt index 10704840da5..ec23e8613a5 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrContinueImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrContinueImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,8 +9,11 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrContinue import org.jetbrains.kotlin.ir.expressions.IrLoop import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrContinueImpl( +class IrContinueImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -31,4 +23,17 @@ class IrContinueImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrContinueImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + loop: IrLoop, +) = IrContinueImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + loop = loop, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDoWhileLoopImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDoWhileLoopImpl.kt index 34a3aa431d0..46b82db08f9 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDoWhileLoopImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDoWhileLoopImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -21,8 +10,11 @@ import org.jetbrains.kotlin.ir.expressions.IrDoWhileLoop import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrDoWhileLoopImpl( +class IrDoWhileLoopImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -35,3 +27,16 @@ class IrDoWhileLoopImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrDoWhileLoopImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + origin: IrStatementOrigin?, +) = IrDoWhileLoopImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + origin = origin, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDynamicMemberExpressionImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDynamicMemberExpressionImpl.kt index b907204c82f..095663705cf 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDynamicMemberExpressionImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDynamicMemberExpressionImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2024 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. */ @@ -9,14 +9,32 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrDynamicMemberExpression import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrDynamicMemberExpressionImpl( +class IrDynamicMemberExpressionImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var memberName: String, - override var receiver: IrExpression + override var receiver: IrExpression, ) : IrDynamicMemberExpression() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrDynamicMemberExpressionImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + memberName: String, + receiver: IrExpression, +) = IrDynamicMemberExpressionImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + memberName = memberName, + receiver = receiver, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDynamicOperatorExpressionImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDynamicOperatorExpressionImpl.kt index 22098dd6aad..1ff2ac560d6 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDynamicOperatorExpressionImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrDynamicOperatorExpressionImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2024 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. */ @@ -10,13 +10,16 @@ import org.jetbrains.kotlin.ir.expressions.IrDynamicOperator import org.jetbrains.kotlin.ir.expressions.IrDynamicOperatorExpression import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator import org.jetbrains.kotlin.utils.SmartList -class IrDynamicOperatorExpressionImpl( +class IrDynamicOperatorExpressionImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - override var operator: IrDynamicOperator + override var operator: IrDynamicOperator, ) : IrDynamicOperatorExpression() { override lateinit var receiver: IrExpression @@ -25,3 +28,16 @@ class IrDynamicOperatorExpressionImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrDynamicOperatorExpressionImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + operator: IrDynamicOperator, +) = IrDynamicOperatorExpressionImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + operator = operator, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrElseBranchImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrElseBranchImpl.kt index 3e8b7d869ed..f7105e57169 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrElseBranchImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrElseBranchImpl.kt @@ -7,13 +7,37 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.ir.expressions.IrElseBranch import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrElseBranchImpl( +class IrElseBranchImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var condition: IrExpression, - override var result: IrExpression -) : IrElseBranch() { - constructor(condition: IrExpression, result: IrExpression) : - this(condition.startOffset, result.endOffset, condition, result) -} \ No newline at end of file + override var result: IrExpression, +) : IrElseBranch() + +fun IrElseBranchImpl( + startOffset: Int, + endOffset: Int, + condition: IrExpression, + result: IrExpression, +) = IrElseBranchImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + condition = condition, + result = result, +) + +fun IrElseBranchImpl( + condition: IrExpression, + result: IrExpression, +) = IrElseBranchImpl( + constructorIndicator = null, + startOffset = condition.startOffset, + endOffset = result.endOffset, + condition = condition, + result = result, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrErrorCallExpressionImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrErrorCallExpressionImpl.kt index bf06f174f53..a993ab2b0ff 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrErrorCallExpressionImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrErrorCallExpressionImpl.kt @@ -9,13 +9,16 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrErrorCallExpression import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator import org.jetbrains.kotlin.utils.SmartList -class IrErrorCallExpressionImpl( +class IrErrorCallExpressionImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - override var description: String + override var description: String, ) : IrErrorCallExpression() { override var explicitReceiver: IrExpression? = null override val arguments: MutableList = SmartList() @@ -23,3 +26,16 @@ class IrErrorCallExpressionImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrErrorCallExpressionImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + description: String, +) = IrErrorCallExpressionImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + description = description, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrErrorExpressionImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrErrorExpressionImpl.kt index ca8d630b244..098c8384382 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrErrorExpressionImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrErrorExpressionImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -19,13 +8,29 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrErrorExpression import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrErrorExpressionImpl( +class IrErrorExpressionImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - override var description: String + override var description: String, ) : IrErrorExpression() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrErrorExpressionImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + description: String, +) = IrErrorExpressionImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + description = description, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrExpressionBodyImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrExpressionBodyImpl.kt index 0dd8d12e759..d5de8f922e8 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrExpressionBodyImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrExpressionBodyImpl.kt @@ -9,7 +9,7 @@ import org.jetbrains.kotlin.ir.IrImplementationDetail import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrExpressionBody -class IrExpressionBodyImpl @IrImplementationDetail constructor( +class IrExpressionBodyImpl @IrImplementationDetail internal constructor( override val startOffset: Int, override val endOffset: Int, override var expression: IrExpression, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFunctionExpressionImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFunctionExpressionImpl.kt index 13910ddc990..3a5032f5627 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFunctionExpressionImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrFunctionExpressionImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2024 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. */ @@ -10,14 +10,32 @@ import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.expressions.IrFunctionExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrFunctionExpressionImpl( +class IrFunctionExpressionImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var function: IrSimpleFunction, - override var origin: IrStatementOrigin + override var origin: IrStatementOrigin, ) : IrFunctionExpression() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrFunctionExpressionImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + function: IrSimpleFunction, + origin: IrStatementOrigin, +) = IrFunctionExpressionImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + function = function, + origin = origin, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetClassImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetClassImpl.kt index cc6082d2ce1..b28975c899f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetClassImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetClassImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,8 +9,11 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrGetClass import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrGetClassImpl( +class IrGetClassImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -29,4 +21,17 @@ class IrGetClassImpl( ) : IrGetClass() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrGetClassImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + argument: IrExpression, +) = IrGetClassImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + argument = argument, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetEnumValueImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetEnumValueImpl.kt index 301e133743d..0f0d12abb85 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetEnumValueImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetEnumValueImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,8 +9,11 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue import org.jetbrains.kotlin.ir.symbols.IrEnumEntrySymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrGetEnumValueImpl( +class IrGetEnumValueImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -29,4 +21,17 @@ class IrGetEnumValueImpl( ) : IrGetEnumValue() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrGetEnumValueImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + symbol: IrEnumEntrySymbol, +) = IrGetEnumValueImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + symbol = symbol, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetFieldImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetFieldImpl.kt index 583c05cb11b..d754bac7366 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetFieldImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetFieldImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -23,28 +12,57 @@ import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrGetFieldImpl( +class IrGetFieldImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var symbol: IrFieldSymbol, override var type: IrType, - override var origin: IrStatementOrigin? = null, - override var superQualifierSymbol: IrClassSymbol? = null, + override var origin: IrStatementOrigin?, + override var superQualifierSymbol: IrClassSymbol?, ) : IrGetField() { override var receiver: IrExpression? = null override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null - - constructor( - startOffset: Int, endOffset: Int, - symbol: IrFieldSymbol, - type: IrType, - receiver: IrExpression?, - origin: IrStatementOrigin? = null, - superQualifierSymbol: IrClassSymbol? = null - ) : this(startOffset, endOffset, symbol, type, origin, superQualifierSymbol) { - this.receiver = receiver - } +} + +fun IrGetFieldImpl( + startOffset: Int, + endOffset: Int, + symbol: IrFieldSymbol, + type: IrType, + origin: IrStatementOrigin? = null, + superQualifierSymbol: IrClassSymbol? = null, +) = IrGetFieldImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + symbol = symbol, + type = type, + origin = origin, + superQualifierSymbol = superQualifierSymbol, +) + +fun IrGetFieldImpl( + startOffset: Int, + endOffset: Int, + symbol: IrFieldSymbol, + type: IrType, + receiver: IrExpression?, + origin: IrStatementOrigin? = null, + superQualifierSymbol: IrClassSymbol? = null, +) = IrGetFieldImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + symbol = symbol, + type = type, + origin = origin, + superQualifierSymbol = superQualifierSymbol, +).apply { + this.receiver = receiver } diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetObjectValueImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetObjectValueImpl.kt index 7d9eae480d1..77cd9ec7daa 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetObjectValueImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetObjectValueImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,13 +9,29 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrGetObjectValue import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrGetObjectValueImpl( +class IrGetObjectValueImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - override var symbol: IrClassSymbol + override var symbol: IrClassSymbol, ) : IrGetObjectValue() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrGetObjectValueImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + symbol: IrClassSymbol, +) = IrGetObjectValueImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + symbol = symbol, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetValueImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetValueImpl.kt index 213c98d6ed1..b16763adba2 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetValueImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrGetValueImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2024 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. */ @@ -10,24 +10,49 @@ import org.jetbrains.kotlin.ir.expressions.IrGetValue import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.symbols.IrValueSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrGetValueImpl( +class IrGetValueImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var symbol: IrValueSymbol, - override var origin: IrStatementOrigin? = null + override var origin: IrStatementOrigin?, ) : IrGetValue() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null - - constructor( - startOffset: Int, - endOffset: Int, - symbol: IrValueSymbol, - origin: IrStatementOrigin? = null - ) : this(startOffset, endOffset, symbol.owner.type, symbol, origin) } fun IrGetValue.copyWithOffsets(newStartOffset: Int, newEndOffset: Int): IrGetValue = IrGetValueImpl(newStartOffset, newEndOffset, type, symbol, origin) + +fun IrGetValueImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + symbol: IrValueSymbol, + origin: IrStatementOrigin? = null, +) = IrGetValueImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + symbol = symbol, + origin = origin, +) + +fun IrGetValueImpl( + startOffset: Int, + endOffset: Int, + symbol: IrValueSymbol, + origin: IrStatementOrigin? = null, +) = IrGetValueImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = symbol.owner.type, + symbol = symbol, + origin = origin, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrIfThenElseImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrIfThenElseImpl.kt index 45465ccab51..4272d668bc7 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrIfThenElseImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrIfThenElseImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -21,16 +10,32 @@ import org.jetbrains.kotlin.ir.expressions.IrBranch import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.expressions.IrWhen import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator import org.jetbrains.kotlin.utils.SmartList -class IrIfThenElseImpl( +class IrIfThenElseImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - override var origin: IrStatementOrigin? = null + override var origin: IrStatementOrigin?, ) : IrWhen() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null override val branches: MutableList = SmartList() } + +fun IrIfThenElseImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + origin: IrStatementOrigin? = null, +) = IrIfThenElseImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + origin = origin, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrInlinedFunctionBlockImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrInlinedFunctionBlockImpl.kt index 0a54970c5fd..4cb3fdc382f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrInlinedFunctionBlockImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrInlinedFunctionBlockImpl.kt @@ -12,29 +12,57 @@ import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression import org.jetbrains.kotlin.ir.expressions.IrInlinedFunctionBlock import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrInlinedFunctionBlockImpl( +class IrInlinedFunctionBlockImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var inlineCall: IrFunctionAccessExpression, override var inlinedElement: IrElement, - override var origin: IrStatementOrigin? = null, + override var origin: IrStatementOrigin?, ) : IrInlinedFunctionBlock() { override val statements: MutableList = ArrayList(2) override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null +} - constructor( - startOffset: Int, - endOffset: Int, - type: IrType, - inlineCall: IrFunctionAccessExpression, - inlinedElement: IrElement, - origin: IrStatementOrigin?, - statements: List, - ) : this(startOffset, endOffset, type, inlineCall, inlinedElement, origin) { - this.statements.addAll(statements) - } +fun IrInlinedFunctionBlockImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + inlineCall: IrFunctionAccessExpression, + inlinedElement: IrElement, + origin: IrStatementOrigin? = null, +) = IrInlinedFunctionBlockImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + inlineCall = inlineCall, + inlinedElement = inlinedElement, + origin = origin, +) + +fun IrInlinedFunctionBlockImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + inlineCall: IrFunctionAccessExpression, + inlinedElement: IrElement, + origin: IrStatementOrigin?, + statements: List, +) = IrInlinedFunctionBlockImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + inlineCall = inlineCall, + inlinedElement = inlinedElement, + origin = origin, +).apply { + this.statements.addAll(statements) } \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrInstanceInitializerCallImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrInstanceInitializerCallImpl.kt index a668f4e7155..5beea2b347f 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrInstanceInitializerCallImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrInstanceInitializerCallImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,8 +9,11 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrInstanceInitializerCall import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrInstanceInitializerCallImpl( +class IrInstanceInitializerCallImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var classSymbol: IrClassSymbol, @@ -30,3 +22,16 @@ class IrInstanceInitializerCallImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrInstanceInitializerCallImpl( + startOffset: Int, + endOffset: Int, + classSymbol: IrClassSymbol, + type: IrType, +) = IrInstanceInitializerCallImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + classSymbol = classSymbol, + type = type, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrRawFunctionReferenceImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrRawFunctionReferenceImpl.kt index 0cd41cc460f..f54f5d10912 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrRawFunctionReferenceImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrRawFunctionReferenceImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,8 +9,11 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrRawFunctionReference import org.jetbrains.kotlin.ir.symbols.IrFunctionSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrRawFunctionReferenceImpl( +class IrRawFunctionReferenceImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -29,4 +21,17 @@ class IrRawFunctionReferenceImpl( ) : IrRawFunctionReference() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrRawFunctionReferenceImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + symbol: IrFunctionSymbol, +) = IrRawFunctionReferenceImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + symbol = symbol, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrReturnImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrReturnImpl.kt index e2f6107548b..bd4ddfa0852 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrReturnImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrReturnImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -21,14 +10,32 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrReturn import org.jetbrains.kotlin.ir.symbols.IrReturnTargetSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrReturnImpl( +class IrReturnImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var returnTargetSymbol: IrReturnTargetSymbol, - override var value: IrExpression + override var value: IrExpression, ) : IrReturn() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrReturnImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + returnTargetSymbol: IrReturnTargetSymbol, + value: IrExpression, +) = IrReturnImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + returnTargetSymbol = returnTargetSymbol, + value = value, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrReturnableBlockImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrReturnableBlockImpl.kt index 365e1cc5cb4..59df5dc2e48 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrReturnableBlockImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrReturnableBlockImpl.kt @@ -13,13 +13,16 @@ import org.jetbrains.kotlin.ir.expressions.IrReturnableBlock import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.symbols.IrReturnableBlockSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrReturnableBlockImpl( +class IrReturnableBlockImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override val symbol: IrReturnableBlockSymbol, - override var origin: IrStatementOrigin? = null, + override var origin: IrStatementOrigin?, ) : IrReturnableBlock() { override val statements: MutableList = ArrayList(2) @@ -30,18 +33,40 @@ class IrReturnableBlockImpl( override val descriptor: FunctionDescriptor get() = symbol.descriptor - constructor( - startOffset: Int, - endOffset: Int, - type: IrType, - symbol: IrReturnableBlockSymbol, - origin: IrStatementOrigin?, - statements: List, - ) : this(startOffset, endOffset, type, symbol, origin) { - this.statements.addAll(statements) - } - init { symbol.bind(this) } -} \ No newline at end of file +} + +fun IrReturnableBlockImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + symbol: IrReturnableBlockSymbol, + origin: IrStatementOrigin? = null, +) = IrReturnableBlockImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + symbol = symbol, + origin = origin, +) + +fun IrReturnableBlockImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + symbol: IrReturnableBlockSymbol, + origin: IrStatementOrigin?, + statements: List, +) = IrReturnableBlockImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + symbol = symbol, + origin = origin, +).apply { + this.statements.addAll(statements) +} diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetFieldImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetFieldImpl.kt index 7e981080ad6..b029558fea1 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetFieldImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetFieldImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -23,32 +12,60 @@ import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrFieldSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrSetFieldImpl( +class IrSetFieldImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var symbol: IrFieldSymbol, override var type: IrType, - override var origin: IrStatementOrigin? = null, - override var superQualifierSymbol: IrClassSymbol? = null, + override var origin: IrStatementOrigin?, + override var superQualifierSymbol: IrClassSymbol?, ) : IrSetField() { override var receiver: IrExpression? = null override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null - constructor( - startOffset: Int, endOffset: Int, - symbol: IrFieldSymbol, - receiver: IrExpression?, - value: IrExpression, - type: IrType, - origin: IrStatementOrigin? = null, - superQualifierSymbol: IrClassSymbol? = null - ) : this(startOffset, endOffset, symbol, type, origin, superQualifierSymbol) { - this.receiver = receiver - this.value = value - } - override lateinit var value: IrExpression } + +fun IrSetFieldImpl( + startOffset: Int, + endOffset: Int, + symbol: IrFieldSymbol, + type: IrType, + origin: IrStatementOrigin? = null, + superQualifierSymbol: IrClassSymbol? = null, +) = IrSetFieldImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + symbol = symbol, + type = type, + origin = origin, + superQualifierSymbol = superQualifierSymbol, +) + +fun IrSetFieldImpl( + startOffset: Int, endOffset: Int, + symbol: IrFieldSymbol, + receiver: IrExpression?, + value: IrExpression, + type: IrType, + origin: IrStatementOrigin? = null, + superQualifierSymbol: IrClassSymbol? = null, +) = IrSetFieldImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + symbol = symbol, + type = type, + origin = origin, + superQualifierSymbol = superQualifierSymbol, +).apply { + this.receiver = receiver + this.value = value +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetValueImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetValueImpl.kt index 3d5d6330557..99f7ee95a40 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetValueImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSetValueImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -22,14 +11,17 @@ import org.jetbrains.kotlin.ir.expressions.IrSetValue import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.symbols.IrValueSymbol import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrSetValueImpl( +class IrSetValueImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var symbol: IrValueSymbol, override var value: IrExpression, - override var origin: IrStatementOrigin? + override var origin: IrStatementOrigin?, ) : IrSetValue() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null @@ -40,3 +32,20 @@ class IrSetValueImpl( } } } + +fun IrSetValueImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + symbol: IrValueSymbol, + value: IrExpression, + origin: IrStatementOrigin?, +) = IrSetValueImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + symbol = symbol, + value = value, + origin = origin, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSpreadElementImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSpreadElementImpl.kt index 2f446dd3861..fd4caec2771 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSpreadElementImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSpreadElementImpl.kt @@ -1,26 +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. + * Copyright 2010-2024 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.expressions.impl import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrSpreadElement +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrSpreadElementImpl( +class IrSpreadElementImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var expression: IrExpression, ) : IrSpreadElement() + +fun IrSpreadElementImpl( + startOffset: Int, + endOffset: Int, + expression: IrExpression, +) = IrSpreadElementImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + expression = expression, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrStringConcatenationImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrStringConcatenationImpl.kt index e9d037d7e9b..f33c830dd59 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrStringConcatenationImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrStringConcatenationImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,24 +9,42 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStringConcatenation import org.jetbrains.kotlin.ir.types.IrType -import org.jetbrains.kotlin.utils.SmartList +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrStringConcatenationImpl( +class IrStringConcatenationImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, - override var type: IrType + override var type: IrType, ) : IrStringConcatenation() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null - constructor( - startOffset: Int, - endOffset: Int, - type: IrType, - arguments: Collection - ) : this(startOffset, endOffset, type) { - this.arguments.addAll(arguments) - } - override val arguments: MutableList = ArrayList(2) } + +fun IrStringConcatenationImpl( + startOffset: Int, + endOffset: Int, + type: IrType, +) = IrStringConcatenationImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, +) + +fun IrStringConcatenationImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + arguments: Collection, +) = IrStringConcatenationImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, +).apply { + this.arguments.addAll(arguments) +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSuspendableExpressionImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSuspendableExpressionImpl.kt index 86fa431daec..b91215a3aa6 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSuspendableExpressionImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSuspendableExpressionImpl.kt @@ -9,14 +9,32 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrSuspendableExpression import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrSuspendableExpressionImpl( +class IrSuspendableExpressionImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var suspensionPointId: IrExpression, - override var result: IrExpression + override var result: IrExpression, ) : IrSuspendableExpression() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrSuspendableExpressionImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + suspensionPointId: IrExpression, + result: IrExpression, +) = IrSuspendableExpressionImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + suspensionPointId = suspensionPointId, + result = result, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSuspensionPointImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSuspensionPointImpl.kt index 3e16c0afac2..060482df274 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSuspensionPointImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSuspensionPointImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2024 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. */ @@ -10,15 +10,35 @@ import org.jetbrains.kotlin.ir.declarations.IrVariable import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrSuspensionPoint import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrSuspensionPointImpl( +class IrSuspensionPointImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, override var suspensionPointIdParameter: IrVariable, override var result: IrExpression, - override var resumeResult: IrExpression + override var resumeResult: IrExpression, ) : IrSuspensionPoint() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrSuspensionPointImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + suspensionPointIdParameter: IrVariable, + result: IrExpression, + resumeResult: IrExpression, +) = IrSuspensionPointImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + suspensionPointIdParameter = suspensionPointIdParameter, + result = result, + resumeResult = resumeResult, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSyntheticBodyImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSyntheticBodyImpl.kt index d4ed01c52a6..00813ebb51e 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSyntheticBodyImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrSyntheticBodyImpl.kt @@ -7,9 +7,23 @@ package org.jetbrains.kotlin.ir.expressions.impl import org.jetbrains.kotlin.ir.expressions.IrSyntheticBody import org.jetbrains.kotlin.ir.expressions.IrSyntheticBodyKind +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrSyntheticBodyImpl( +class IrSyntheticBodyImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var kind: IrSyntheticBodyKind, ) : IrSyntheticBody() + +fun IrSyntheticBodyImpl( + startOffset: Int, + endOffset: Int, + kind: IrSyntheticBodyKind, +) = IrSyntheticBodyImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + kind = kind, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrThrowImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrThrowImpl.kt index e39f1d9e881..d409e37c279 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrThrowImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrThrowImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,8 +9,11 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrThrow import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrThrowImpl( +class IrThrowImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -29,4 +21,17 @@ class IrThrowImpl( ) : IrThrow() { override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null -} \ No newline at end of file +} + +fun IrThrowImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + value: IrExpression, +) = IrThrowImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + value = value, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTryImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTryImpl.kt index ed0aa7599f1..e5239ac31f5 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTryImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTryImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -21,26 +10,16 @@ import org.jetbrains.kotlin.ir.expressions.IrCatch import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrTry import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator import org.jetbrains.kotlin.utils.SmartList -class IrTryImpl( +class IrTryImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, ) : IrTry() { - constructor( - startOffset: Int, - endOffset: Int, - type: IrType, - tryResult: IrExpression, - catches: List, - finallyExpression: IrExpression? - ) : this(startOffset, endOffset, type) { - this.tryResult = tryResult - this.catches.addAll(catches) - this.finallyExpression = finallyExpression - } - override lateinit var tryResult: IrExpression override val catches: MutableList = SmartList() @@ -50,3 +29,32 @@ class IrTryImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrTryImpl( + startOffset: Int, + endOffset: Int, + type: IrType, +) = IrTryImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, +) + +fun IrTryImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + tryResult: IrExpression, + catches: List, + finallyExpression: IrExpression?, +) = IrTryImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, +).apply { + this.tryResult = tryResult + this.catches.addAll(catches) + this.finallyExpression = finallyExpression +} diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTypeOperatorCallImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTypeOperatorCallImpl.kt index 1f8c99b1f34..f5f51e76366 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTypeOperatorCallImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrTypeOperatorCallImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -21,8 +10,11 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrTypeOperator import org.jetbrains.kotlin.ir.expressions.IrTypeOperatorCall import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrTypeOperatorCallImpl( +class IrTypeOperatorCallImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -33,3 +25,20 @@ class IrTypeOperatorCallImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrTypeOperatorCallImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + operator: IrTypeOperator, + typeOperand: IrType, + argument: IrExpression, +) = IrTypeOperatorCallImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + operator = operator, + typeOperand = typeOperand, + argument = argument, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrVarargImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrVarargImpl.kt index 63530a01cbb..2f8c66ef8ef 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrVarargImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrVarargImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -20,26 +9,48 @@ import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer import org.jetbrains.kotlin.ir.expressions.IrVararg import org.jetbrains.kotlin.ir.expressions.IrVarargElement import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator import org.jetbrains.kotlin.utils.SmartList -class IrVarargImpl( +class IrVarargImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - override var varargElementType: IrType + override var varargElementType: IrType, ) : IrVararg() { - constructor( - startOffset: Int, - endOffset: Int, - type: IrType, - varargElementType: IrType, - elements: List - ) : this(startOffset, endOffset, type, varargElementType) { - this.elements.addAll(elements) - } - override val elements: MutableList = SmartList() override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrVarargImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + varargElementType: IrType, +) = IrVarargImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + varargElementType = varargElementType, +) + +fun IrVarargImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + varargElementType: IrType, + elements: List, +) = IrVarargImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + varargElementType = varargElementType, +).apply { + this.elements.addAll(elements) +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrWhenImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrWhenImpl.kt index 3422a8be862..f01e2342049 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrWhenImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrWhenImpl.kt @@ -1,43 +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. + * Copyright 2010-2024 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.expressions.impl import org.jetbrains.kotlin.ir.declarations.IrAttributeContainer -import org.jetbrains.kotlin.ir.expressions.* +import org.jetbrains.kotlin.ir.expressions.IrBranch +import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin +import org.jetbrains.kotlin.ir.expressions.IrWhen import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrWhenImpl( +class IrWhenImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, - override var origin: IrStatementOrigin? = null + override var origin: IrStatementOrigin?, ) : IrWhen() { - constructor( - startOffset: Int, - endOffset: Int, - type: IrType, - origin: IrStatementOrigin?, - branches: List - ) : this(startOffset, endOffset, type, origin) { - this.branches.addAll(branches) - } - override val branches: MutableList = ArrayList(2) override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrWhenImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + origin: IrStatementOrigin? = null, +) = IrWhenImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + origin = origin, +) + +fun IrWhenImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + origin: IrStatementOrigin?, + branches: List, +) = IrWhenImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + origin = origin, +).apply { + this.branches.addAll(branches) +} \ No newline at end of file diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrWhileLoopImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrWhileLoopImpl.kt index 58edbb37acb..22992847231 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrWhileLoopImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrWhileLoopImpl.kt @@ -1,17 +1,6 @@ /* - * 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. + * Copyright 2010-2024 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.expressions.impl @@ -21,8 +10,11 @@ import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.expressions.IrWhileLoop import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.util.IrElementConstructorIndicator -class IrWhileLoopImpl( +class IrWhileLoopImpl internal constructor( + @Suppress("UNUSED_PARAMETER") + constructorIndicator: IrElementConstructorIndicator?, override val startOffset: Int, override val endOffset: Int, override var type: IrType, @@ -35,3 +27,16 @@ class IrWhileLoopImpl( override var attributeOwnerId: IrAttributeContainer = this override var originalBeforeInline: IrAttributeContainer? = null } + +fun IrWhileLoopImpl( + startOffset: Int, + endOffset: Int, + type: IrType, + origin: IrStatementOrigin?, +) = IrWhileLoopImpl( + constructorIndicator = null, + startOffset = startOffset, + endOffset = endOffset, + type = type, + origin = origin, +) diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrElementConstructorIndicator.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrElementConstructorIndicator.kt new file mode 100644 index 00000000000..a06d875b0d1 --- /dev/null +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/util/IrElementConstructorIndicator.kt @@ -0,0 +1,13 @@ +/* + * Copyright 2010-2024 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.util + +/** +A hack used to force compiler to resolve calls to a +constructor, instead of builder function with the same name. +To be removed soon. + */ +internal object IrElementConstructorIndicator \ No newline at end of file