[FIR IDE] Make fir resolve phase volatile and remove locks
This commit is contained in:
+1
-1
@@ -73,7 +73,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
|
||||
declaration.configure {
|
||||
+symbolWithPackage("fir.symbols", "FirBasedSymbol", "out FirDeclaration")
|
||||
+field("moduleData", firModuleDataType)
|
||||
+field("resolvePhase", resolvePhaseType, withReplace = true).apply { isMutable = true }
|
||||
+field("resolvePhase", resolvePhaseType, withReplace = true).apply { isMutable = true; isVolatile = true }
|
||||
+field("origin", declarationOriginType)
|
||||
+field("attributes", declarationAttributesType)
|
||||
shouldBeAbstractClass()
|
||||
|
||||
+10
-3
@@ -11,6 +11,7 @@ sealed class Field : Importable {
|
||||
abstract val name: String
|
||||
open val arguments = mutableListOf<Importable>()
|
||||
abstract val nullable: Boolean
|
||||
abstract var isVolatile: Boolean
|
||||
open var withReplace: Boolean = false
|
||||
abstract val isFirType: Boolean
|
||||
|
||||
@@ -71,6 +72,7 @@ sealed class Field : Importable {
|
||||
class FieldWithDefault(val origin: Field) : Field() {
|
||||
override val name: String get() = origin.name
|
||||
override val type: String get() = origin.type
|
||||
override var isVolatile: Boolean = origin.isVolatile
|
||||
override val nullable: Boolean get() = origin.nullable
|
||||
override var withReplace: Boolean
|
||||
get() = origin.withReplace
|
||||
@@ -123,7 +125,8 @@ class SimpleField(
|
||||
override val packageName: String?,
|
||||
val customType: Importable? = null,
|
||||
override val nullable: Boolean,
|
||||
override var withReplace: Boolean
|
||||
override var withReplace: Boolean,
|
||||
override var isVolatile: Boolean = false
|
||||
) : Field() {
|
||||
override val isFirType: Boolean = false
|
||||
override val fullQualifiedName: String?
|
||||
@@ -138,7 +141,8 @@ class SimpleField(
|
||||
packageName,
|
||||
customType,
|
||||
nullable,
|
||||
withReplace
|
||||
withReplace,
|
||||
isVolatile
|
||||
).apply {
|
||||
withBindThis = this@SimpleField.withBindThis
|
||||
}
|
||||
@@ -150,7 +154,8 @@ class SimpleField(
|
||||
newType.packageName,
|
||||
customType,
|
||||
nullable,
|
||||
withReplace
|
||||
withReplace,
|
||||
isVolatile
|
||||
).also {
|
||||
it.withBindThis = withBindThis
|
||||
updateFieldsInCopy(it)
|
||||
@@ -170,6 +175,7 @@ class FirField(
|
||||
}
|
||||
|
||||
override val type: String get() = element.type
|
||||
override var isVolatile: Boolean = false
|
||||
override val packageName: String? get() = element.packageName
|
||||
override val isFirType: Boolean = true
|
||||
|
||||
@@ -202,6 +208,7 @@ class FieldList(
|
||||
override val nullable: Boolean
|
||||
get() = false
|
||||
|
||||
override var isVolatile: Boolean = false
|
||||
override var isMutable: Boolean = true
|
||||
|
||||
override fun internalCopy(): Field {
|
||||
|
||||
-1
@@ -37,7 +37,6 @@ fun Element.generateCode(generationPath: File): GeneratedFile {
|
||||
fun SmartPrinter.printElement(element: Element) {
|
||||
with(element) {
|
||||
val isInterface = kind == Kind.Interface || kind == Kind.SealedInterface
|
||||
|
||||
fun abstract() {
|
||||
if (!isInterface) {
|
||||
print("abstract ")
|
||||
|
||||
+7
@@ -6,10 +6,14 @@
|
||||
package org.jetbrains.kotlin.fir.tree.generator.printer
|
||||
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.Field
|
||||
import org.jetbrains.kotlin.fir.tree.generator.model.SimpleField
|
||||
import org.jetbrains.kotlin.util.SmartPrinter
|
||||
|
||||
|
||||
fun SmartPrinter.printField(field: Field, isImplementation: Boolean, override: Boolean, end: String) {
|
||||
if (isImplementation && !field.isVal && field.isVolatile) {
|
||||
println("@Volatile")
|
||||
}
|
||||
if (override) {
|
||||
print("override ")
|
||||
}
|
||||
@@ -23,6 +27,9 @@ fun SmartPrinter.printField(field: Field, isImplementation: Boolean, override: B
|
||||
}
|
||||
|
||||
fun SmartPrinter.printFieldWithDefaultInImplementation(field: Field) {
|
||||
if (!field.isVal && field.isVolatile) {
|
||||
println("@Volatile")
|
||||
}
|
||||
val defaultValue = field.defaultValueInImplementation
|
||||
print("override ")
|
||||
if (field.isVal) {
|
||||
|
||||
+2
@@ -73,6 +73,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
}
|
||||
println("(")
|
||||
withIndent {
|
||||
|
||||
fieldsWithoutDefault.forEachIndexed { _, field ->
|
||||
printField(field, isImplementation = true, override = true, end = ",")
|
||||
}
|
||||
@@ -89,6 +90,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
withIndent {
|
||||
if (isInterface || isAbstract) {
|
||||
allFields.forEach {
|
||||
|
||||
abstract()
|
||||
printField(it, isImplementation = true, override = true, end = "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user