[FIR JS] Add checkers.js
This commit is contained in:
@@ -20,6 +20,7 @@ dependencies {
|
||||
testApi(project(":compiler:cli"))
|
||||
testApi(project(":compiler:fir:checkers"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.jvm"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.js"))
|
||||
testApi(project(":compiler:fir:fir-serialization"))
|
||||
testApi(project(":compiler:fir:entrypoint"))
|
||||
testApi(project(":compiler:frontend"))
|
||||
|
||||
@@ -19,6 +19,7 @@ dependencies {
|
||||
testApi(projectTests(":compiler:tests-common"))
|
||||
testApi(project(":compiler:fir:checkers"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.jvm"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.js"))
|
||||
testApi(project(":compiler:fir:entrypoint"))
|
||||
testApi(project(":compiler:frontend"))
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ val generationRoot = projectDir.resolve("gen")
|
||||
|
||||
// Add modules for js and native checkers here
|
||||
val platformGenerationRoots = listOf(
|
||||
"checkers.jvm"
|
||||
"checkers.jvm",
|
||||
"checkers.js",
|
||||
).map { projectDir.resolve(it).resolve("gen") }
|
||||
|
||||
val generateCheckersComponents by tasks.registering(NoDebugJavaExec::class) {
|
||||
|
||||
+3
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.fir.checkers.generator
|
||||
|
||||
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.DIAGNOSTICS_LIST
|
||||
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.JS_DIAGNOSTICS_LIST
|
||||
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.JVM_DIAGNOSTICS_LIST
|
||||
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.model.generateDiagnostics
|
||||
import org.jetbrains.kotlin.fir.declarations.*
|
||||
@@ -95,10 +96,12 @@ fun main(args: Array<String>) {
|
||||
}
|
||||
|
||||
val jvmGenerationPath = File(arguments.getOrElse(1) { "compiler/fir/checkers/checkers.jvm/gen" })
|
||||
val jsGenerationPath = File(arguments.getOrElse(2) { "compiler/fir/checkers/checkers.js/gen" })
|
||||
val rawFirGenerationPath = File("compiler/fir/raw-fir/raw-fir.common/gen")
|
||||
|
||||
generateDiagnostics(generationPath, "$basePackage.diagnostics", DIAGNOSTICS_LIST, starImportsToAdd = setOf(ErrorListDiagnosticListRenderer.BASE_PACKAGE, ErrorListDiagnosticListRenderer.DIAGNOSTICS_PACKAGE))
|
||||
generateDiagnostics(jvmGenerationPath, "$basePackage.diagnostics.jvm", JVM_DIAGNOSTICS_LIST, starImportsToAdd = setOf(ErrorListDiagnosticListRenderer.BASE_PACKAGE, ErrorListDiagnosticListRenderer.DIAGNOSTICS_PACKAGE))
|
||||
generateDiagnostics(jsGenerationPath, "$basePackage.diagnostics.js", JS_DIAGNOSTICS_LIST, starImportsToAdd = setOf(ErrorListDiagnosticListRenderer.BASE_PACKAGE, ErrorListDiagnosticListRenderer.DIAGNOSTICS_PACKAGE))
|
||||
generateDiagnostics(rawFirGenerationPath, "org.jetbrains.kotlin.fir.builder", SYNTAX_DIAGNOSTIC_LIST, starImportsToAdd = setOf(ErrorListDiagnosticListRenderer.DIAGNOSTICS_PACKAGE))
|
||||
}
|
||||
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.fir.checkers.generator.diagnostics
|
||||
|
||||
import org.jetbrains.kotlin.fir.PrivateForInline
|
||||
import org.jetbrains.kotlin.fir.checkers.generator.diagnostics.model.DiagnosticList
|
||||
|
||||
@Suppress("UNUSED_VARIABLE", "LocalVariableName", "ClassName", "unused")
|
||||
@OptIn(PrivateForInline::class)
|
||||
object JS_DIAGNOSTICS_LIST : DiagnosticList("FirJsErrors")
|
||||
@@ -0,0 +1,38 @@
|
||||
import org.jetbrains.kotlin.ideaExt.idea
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("jps-compatible")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(project(":compiler:fir:checkers"))
|
||||
|
||||
/*
|
||||
* We can't remove this dependency until we use
|
||||
* diagnostics framework from FE 1.0
|
||||
*/
|
||||
implementation(project(":compiler:frontend"))
|
||||
implementation(project(":compiler:psi"))
|
||||
|
||||
compileOnly(project(":kotlin-reflect-api"))
|
||||
compileOnly(intellijCore())
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" {
|
||||
projectDefault()
|
||||
this.java.srcDir("gen")
|
||||
}
|
||||
"test" { none() }
|
||||
}
|
||||
|
||||
val compileKotlin by tasks
|
||||
compileKotlin.dependsOn(":compiler:fir:checkers:generateCheckersComponents")
|
||||
|
||||
if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
apply(plugin = "idea")
|
||||
idea {
|
||||
this.module.generatedSourceDirs.add(projectDir.resolve("gen"))
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.fir.analysis.diagnostics.js
|
||||
|
||||
import org.jetbrains.kotlin.diagnostics.*
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.RootDiagnosticRendererFactory
|
||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.*
|
||||
|
||||
/*
|
||||
* This file was generated automatically
|
||||
* DO NOT MODIFY IT MANUALLY
|
||||
*/
|
||||
|
||||
object FirJsErrors {
|
||||
init {
|
||||
RootDiagnosticRendererFactory.registerFactory(FirJsErrorsDefaultMessages)
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.fir.analysis.diagnostics.js
|
||||
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnosticFactoryToRendererMap
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.BaseDiagnosticRendererFactory
|
||||
|
||||
@Suppress("unused")
|
||||
object FirJsErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
override val MAP = KtDiagnosticFactoryToRendererMap("FIR").also { _ ->
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.fir.analysis.js.checkers
|
||||
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.declaration.*
|
||||
|
||||
object JsDeclarationCheckers : DeclarationCheckers()
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2010-2021 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.fir.analysis.js.checkers
|
||||
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.expression.*
|
||||
|
||||
object JsExpressionCheckers : ExpressionCheckers()
|
||||
@@ -12,6 +12,7 @@ dependencies {
|
||||
api(project(":compiler:fir:fir2ir"))
|
||||
api(project(":compiler:fir:checkers"))
|
||||
api(project(":compiler:fir:checkers:checkers.jvm"))
|
||||
api(project(":compiler:fir:checkers:checkers.js"))
|
||||
|
||||
// TODO: do not use GeneratorExtensions in `FirAnalyzerFacade.convertToIr`, and make this an 'implementation' dependency.
|
||||
api(project(":compiler:ir.psi2ir"))
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
package org.jetbrains.kotlin.fir.checkers
|
||||
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.*
|
||||
import org.jetbrains.kotlin.fir.analysis.js.checkers.JsDeclarationCheckers
|
||||
import org.jetbrains.kotlin.fir.analysis.js.checkers.JsExpressionCheckers
|
||||
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.JvmDeclarationCheckers
|
||||
import org.jetbrains.kotlin.fir.analysis.jvm.checkers.JvmExpressionCheckers
|
||||
import org.jetbrains.kotlin.fir.session.FirSessionFactory
|
||||
@@ -26,3 +28,8 @@ fun FirSessionFactory.FirSessionConfigurator.registerJvmCheckers() {
|
||||
useCheckers(JvmDeclarationCheckers)
|
||||
useCheckers(JvmExpressionCheckers)
|
||||
}
|
||||
|
||||
fun FirSessionFactory.FirSessionConfigurator.registerJsCheckers() {
|
||||
useCheckers(JsDeclarationCheckers)
|
||||
useCheckers(JsExpressionCheckers)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user