[FIR JS] Add checkers.js
This commit is contained in:
@@ -12,6 +12,7 @@ dependencies {
|
||||
api(project(":compiler:fir:semantics"))
|
||||
api(project(":compiler:fir:checkers"))
|
||||
api(project(":compiler:fir:checkers:checkers.jvm"))
|
||||
api(project(":compiler:fir:checkers:checkers.js"))
|
||||
api(project(":compiler:fir:java"))
|
||||
api(project(":analysis:low-level-api-fir"))
|
||||
api(project(":analysis:analysis-api"))
|
||||
|
||||
@@ -14,9 +14,11 @@ dependencies {
|
||||
api(project(":compiler:fir:semantics"))
|
||||
api(project(":compiler:fir:checkers"))
|
||||
api(project(":compiler:fir:checkers:checkers.jvm"))
|
||||
api(project(":compiler:fir:checkers:checkers.js"))
|
||||
api(project(":compiler:fir:java"))
|
||||
api(project(":compiler:backend.common.jvm"))
|
||||
api(project(":analysis:analysis-api-impl-barebone"))
|
||||
api(project(":js:js.config"))
|
||||
testApi(project(":analysis:analysis-api-fir"))
|
||||
implementation(project(":compiler:frontend.common"))
|
||||
implementation(project(":compiler:ir.psi2ir"))
|
||||
|
||||
+5
@@ -17,10 +17,13 @@ import org.jetbrains.kotlin.fir.analysis.checkers.expression.ExpressionCheckers
|
||||
import org.jetbrains.kotlin.fir.analysis.checkers.type.TypeCheckers
|
||||
import org.jetbrains.kotlin.fir.analysis.collectors.AbstractDiagnosticCollector
|
||||
import org.jetbrains.kotlin.fir.analysis.collectors.components.*
|
||||
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.platform.SimplePlatform
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatform
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatform
|
||||
|
||||
internal abstract class AbstractLLFirDiagnosticsCollector(
|
||||
session: FirSession,
|
||||
@@ -66,6 +69,7 @@ private object CheckersFactory {
|
||||
add(CommonDeclarationCheckers)
|
||||
when (platform) {
|
||||
is JvmPlatform -> add(JvmDeclarationCheckers)
|
||||
is JsPlatform -> add(JsDeclarationCheckers)
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
@@ -81,6 +85,7 @@ private object CheckersFactory {
|
||||
add(CommonExpressionCheckers)
|
||||
when (platform) {
|
||||
is JvmPlatform -> add(JvmExpressionCheckers)
|
||||
is JsPlatform -> add(JsExpressionCheckers)
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ val firCompilerCoreModules = arrayOf(
|
||||
":compiler:fir:raw-fir:psi2fir",
|
||||
":compiler:fir:checkers",
|
||||
":compiler:fir:checkers:checkers.jvm",
|
||||
":compiler:fir:checkers:checkers.js",
|
||||
":compiler:fir:entrypoint", // TODO should not be in core modules but FIR IDE uses DependencyListForCliModule from this module
|
||||
":compiler:fir:fir2ir:jvm-backend", // TODO should not be in core modules but FIR IDE uses Fir2IrSignatureComposer from this module
|
||||
":compiler:fir:fir2ir" // TODO should not be in core modules but FIR IDE uses Fir2IrSignatureComposer from this module
|
||||
|
||||
@@ -31,6 +31,7 @@ dependencies {
|
||||
api(project(":compiler:fir:fir2ir:jvm-backend"))
|
||||
api(project(":compiler:fir:checkers"))
|
||||
api(project(":compiler:fir:checkers:checkers.jvm"))
|
||||
api(project(":compiler:fir:checkers:checkers.js"))
|
||||
api(project(":kotlin-util-klib"))
|
||||
api(project(":kotlin-util-io"))
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
+2
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl
|
||||
import org.jetbrains.kotlin.fir.*
|
||||
import org.jetbrains.kotlin.fir.analysis.FirOverridesBackwardCompatibilityHelper
|
||||
import org.jetbrains.kotlin.fir.checkers.registerCommonCheckers
|
||||
import org.jetbrains.kotlin.fir.checkers.registerJsCheckers
|
||||
import org.jetbrains.kotlin.fir.deserialization.ModuleDataProvider
|
||||
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar
|
||||
import org.jetbrains.kotlin.fir.extensions.FirSwitchableExtensionDeclarationsSymbolProvider
|
||||
@@ -112,6 +113,7 @@ object FirJsSessionFactory {
|
||||
|
||||
FirSessionFactory.FirSessionConfigurator(this).apply {
|
||||
registerCommonCheckers()
|
||||
registerJsCheckers()
|
||||
for (extensionRegistrar in extensionRegistrars) {
|
||||
registerExtensions(extensionRegistrar.configure())
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ dependencies {
|
||||
testApi(project(":compiler:fir:semantics"))
|
||||
testApi(project(":compiler:fir:checkers"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.jvm"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.js"))
|
||||
testApi(project(":compiler:fir:java"))
|
||||
testApi(project(":compiler:fir:entrypoint"))
|
||||
testApi(project(":compiler:ir.ir2cfg"))
|
||||
|
||||
@@ -24,6 +24,7 @@ dependencies {
|
||||
testApi(projectTests(":compiler:test-infrastructure-utils"))
|
||||
testApi(project(":compiler:fir:checkers"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.jvm"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.js"))
|
||||
|
||||
testCompileOnly(project(":kotlin-reflect-api"))
|
||||
testRuntimeOnly(project(":kotlin-reflect"))
|
||||
|
||||
@@ -44,6 +44,7 @@ dependencies {
|
||||
// FIR dependencies
|
||||
testApi(project(":compiler:fir:checkers"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.jvm"))
|
||||
testApi(project(":compiler:fir:checkers:checkers.js"))
|
||||
testApi(project(":plugins:parcelize:parcelize-compiler:parcelize-fir"))
|
||||
testRuntimeOnly(project(":compiler:fir:fir-serialization"))
|
||||
|
||||
|
||||
@@ -318,6 +318,7 @@ include ":compiler:fir",
|
||||
":compiler:fir:dump",
|
||||
":compiler:fir:checkers",
|
||||
":compiler:fir:checkers:checkers.jvm",
|
||||
":compiler:fir:checkers:checkers.js",
|
||||
":compiler:fir:checkers:checkers-component-generator",
|
||||
":compiler:fir:entrypoint",
|
||||
":compiler:fir:analysis-tests",
|
||||
|
||||
Reference in New Issue
Block a user