Add path to FirFile to pass it to the DiagnosticContext

This commit is contained in:
Ilya Chernikov
2021-09-29 17:58:07 +02:00
parent 1e056a7aa8
commit 5446168770
15 changed files with 31 additions and 14 deletions
@@ -29,6 +29,7 @@ abstract class FirFile : FirAnnotatedDeclaration() {
abstract val imports: List<FirImport>
abstract val declarations: List<FirDeclaration>
abstract val name: String
abstract val path: String?
abstract override val symbol: FirFileSymbol
override fun <R, D> accept(visitor: FirVisitor<R, D>, data: D): R = visitor.visitFile(this, data)
@@ -39,6 +39,7 @@ class FirFileBuilder : FirAnnotationContainerBuilder {
val imports: MutableList<FirImport> = mutableListOf()
val declarations: MutableList<FirDeclaration> = mutableListOf()
lateinit var name: String
var path: String? = null
override fun build(): FirFile {
return FirFileImpl(
@@ -52,6 +53,7 @@ class FirFileBuilder : FirAnnotationContainerBuilder {
imports,
declarations,
name,
path,
)
}
@@ -35,6 +35,7 @@ internal class FirFileImpl(
override val imports: MutableList<FirImport>,
override val declarations: MutableList<FirDeclaration>,
override val name: String,
override val path: String?,
) : FirFile() {
override val symbol: FirFileSymbol = FirFileSymbol()
@@ -415,6 +415,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
+fieldList(import).withTransform()
+declarations.withTransform()
+stringField("name")
+stringField("path", nullable = true)
+symbol("FirFileSymbol")
}