[IR] Autogenerate IrScriptImpl
^KT-65773 In Progress
This commit is contained in:
committed by
Space Team
parent
f30f2216cc
commit
97e2dab9f0
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.ir.declarations
|
package org.jetbrains.kotlin.ir.declarations
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrStatementContainer
|
import org.jetbrains.kotlin.ir.expressions.IrStatementContainer
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
||||||
@@ -24,6 +26,9 @@ import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
|||||||
abstract class IrScript : IrDeclarationBase(), IrDeclarationWithName, IrDeclarationParent, IrStatementContainer, IrMetadataSourceOwner {
|
abstract class IrScript : IrDeclarationBase(), IrDeclarationWithName, IrDeclarationParent, IrStatementContainer, IrMetadataSourceOwner {
|
||||||
abstract override val symbol: IrScriptSymbol
|
abstract override val symbol: IrScriptSymbol
|
||||||
|
|
||||||
|
@ObsoleteDescriptorBasedAPI
|
||||||
|
abstract override val descriptor: ScriptDescriptor
|
||||||
|
|
||||||
abstract var thisReceiver: IrValueParameter?
|
abstract var thisReceiver: IrValueParameter?
|
||||||
|
|
||||||
abstract var baseClass: IrType?
|
abstract var baseClass: IrType?
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// This file was generated automatically. See compiler/ir/ir.tree/tree-generator/ReadMe.md.
|
||||||
|
// DO NOT MODIFY IT MANUALLY.
|
||||||
|
|
||||||
|
@file:Suppress("DuplicatedCode", "unused")
|
||||||
|
|
||||||
package org.jetbrains.kotlin.ir.declarations.impl
|
package org.jetbrains.kotlin.ir.declarations.impl
|
||||||
|
|
||||||
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
import org.jetbrains.kotlin.descriptors.ScriptDescriptor
|
||||||
@@ -15,10 +20,6 @@ import org.jetbrains.kotlin.ir.symbols.IrPropertySymbol
|
|||||||
import org.jetbrains.kotlin.ir.symbols.IrScriptSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrScriptSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrType
|
import org.jetbrains.kotlin.ir.types.IrType
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.utils.SmartList
|
|
||||||
|
|
||||||
private val SCRIPT_ORIGIN = IrDeclarationOriginImpl("SCRIPT")
|
|
||||||
val SCRIPT_K2_ORIGIN = IrDeclarationOriginImpl("SCRIPT_K2")
|
|
||||||
|
|
||||||
class IrScriptImpl(
|
class IrScriptImpl(
|
||||||
override val symbol: IrScriptSymbol,
|
override val symbol: IrScriptSymbol,
|
||||||
@@ -27,34 +28,44 @@ class IrScriptImpl(
|
|||||||
override val startOffset: Int,
|
override val startOffset: Int,
|
||||||
override val endOffset: Int,
|
override val endOffset: Int,
|
||||||
) : IrScript() {
|
) : IrScript() {
|
||||||
|
override var annotations: List<IrConstructorCall> = emptyList()
|
||||||
|
|
||||||
override var origin: IrDeclarationOrigin = SCRIPT_ORIGIN
|
override var origin: IrDeclarationOrigin = SCRIPT_ORIGIN
|
||||||
|
|
||||||
override lateinit var parent: IrDeclarationParent
|
override lateinit var parent: IrDeclarationParent
|
||||||
|
|
||||||
override var annotations: List<IrConstructorCall> = SmartList()
|
override val statements: MutableList<IrStatement> = ArrayList()
|
||||||
|
|
||||||
override val statements: MutableList<IrStatement> = mutableListOf()
|
|
||||||
|
|
||||||
override var metadata: MetadataSource? = null
|
override var metadata: MetadataSource? = null
|
||||||
|
|
||||||
override var thisReceiver: IrValueParameter? = null
|
|
||||||
override var baseClass: IrType? = null
|
|
||||||
|
|
||||||
override lateinit var explicitCallParameters: List<IrVariable>
|
|
||||||
override lateinit var implicitReceiversParameters: List<IrValueParameter>
|
|
||||||
override lateinit var providedProperties: List<IrPropertySymbol>
|
|
||||||
override lateinit var providedPropertiesParameters: List<IrValueParameter>
|
|
||||||
override var resultProperty: IrPropertySymbol? = null
|
|
||||||
override var earlierScriptsParameter: IrValueParameter? = null
|
|
||||||
override var importedScripts: List<IrScriptSymbol>? = null
|
|
||||||
override var earlierScripts: List<IrScriptSymbol>? = null
|
|
||||||
override var targetClass: IrClassSymbol? = null
|
|
||||||
override var constructor: IrConstructor? = null
|
|
||||||
|
|
||||||
@ObsoleteDescriptorBasedAPI
|
@ObsoleteDescriptorBasedAPI
|
||||||
override val descriptor: ScriptDescriptor
|
override val descriptor: ScriptDescriptor
|
||||||
get() = symbol.descriptor
|
get() = symbol.descriptor
|
||||||
|
|
||||||
|
override var thisReceiver: IrValueParameter? = null
|
||||||
|
|
||||||
|
override var baseClass: IrType? = null
|
||||||
|
|
||||||
|
override lateinit var explicitCallParameters: List<IrVariable>
|
||||||
|
|
||||||
|
override lateinit var implicitReceiversParameters: List<IrValueParameter>
|
||||||
|
|
||||||
|
override lateinit var providedProperties: List<IrPropertySymbol>
|
||||||
|
|
||||||
|
override lateinit var providedPropertiesParameters: List<IrValueParameter>
|
||||||
|
|
||||||
|
override var resultProperty: IrPropertySymbol? = null
|
||||||
|
|
||||||
|
override var earlierScriptsParameter: IrValueParameter? = null
|
||||||
|
|
||||||
|
override var importedScripts: List<IrScriptSymbol>? = null
|
||||||
|
|
||||||
|
override var earlierScripts: List<IrScriptSymbol>? = null
|
||||||
|
|
||||||
|
override var targetClass: IrClassSymbol? = null
|
||||||
|
|
||||||
|
override var constructor: IrConstructor? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
symbol.bind(this)
|
symbol.bind(this)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* 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.declarations.impl
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOriginImpl
|
||||||
|
|
||||||
|
internal val SCRIPT_ORIGIN = IrDeclarationOriginImpl("SCRIPT")
|
||||||
|
val SCRIPT_K2_ORIGIN = IrDeclarationOriginImpl("SCRIPT_K2")
|
||||||
+8
-1
@@ -98,7 +98,14 @@ object ImplementationConfigurator : AbstractIrTreeImplementationConfigurator() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl(script) {
|
impl(script) {
|
||||||
implementation.doPrint = false
|
implementation.putImplementationOptInInConstructor = false
|
||||||
|
implementation.constructorParameterOrderOverride = listOf("symbol", "name", "factory", "startOffset", "endOffset")
|
||||||
|
defaultNull(
|
||||||
|
"thisReceiver", "baseClass", "resultProperty", "earlierScriptsParameter",
|
||||||
|
"importedScripts", "earlierScripts", "targetClass", "constructor"
|
||||||
|
)
|
||||||
|
isLateinit("explicitCallParameters", "implicitReceiversParameters", "providedProperties", "providedPropertiesParameters")
|
||||||
|
default("origin", "SCRIPT_ORIGIN")
|
||||||
}
|
}
|
||||||
|
|
||||||
impl(moduleFragment) {
|
impl(moduleFragment) {
|
||||||
|
|||||||
@@ -537,6 +537,7 @@ object IrTree : AbstractTreeBuilder() {
|
|||||||
parent(metadataSourceOwner)
|
parent(metadataSourceOwner)
|
||||||
|
|
||||||
+symbol(scriptSymbolType)
|
+symbol(scriptSymbolType)
|
||||||
|
+descriptor("ScriptDescriptor")
|
||||||
// NOTE: is the result of the FE conversion, because there script interpreted as a class and has receiver
|
// NOTE: is the result of the FE conversion, because there script interpreted as a class and has receiver
|
||||||
// TODO: consider removing from here and handle appropriately in the lowering
|
// TODO: consider removing from here and handle appropriately in the lowering
|
||||||
+field("thisReceiver", valueParameter, nullable = true) // K1
|
+field("thisReceiver", valueParameter, nullable = true) // K1
|
||||||
|
|||||||
Reference in New Issue
Block a user