All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetbrains.kotlin.checkers.DiagnosticDescriptors.kt Maven / Gradle / Ivy

There is a newer version: 2.1.0-RC
Show newest version
/*
 * Copyright 2010-2019 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.checkers

import com.intellij.openapi.util.TextRange
import org.jetbrains.kotlin.checkers.diagnostics.AbstractTestDiagnostic
import org.jetbrains.kotlin.checkers.diagnostics.PositionalTextDiagnostic
import org.jetbrains.kotlin.checkers.diagnostics.TextDiagnostic

abstract class AbstractDiagnosticDescriptor internal constructor(val start: Int, val end: Int) {
    val textRange: TextRange
        get() = TextRange(start, end)
}

class ActualDiagnosticDescriptor internal constructor(start: Int, end: Int, val diagnostics: List) :
    AbstractDiagnosticDescriptor(start, end) {

    val textDiagnosticsMap: MutableMap
        get() {
            val diagnosticMap = mutableMapOf()
            for (diagnostic in diagnostics) {
                diagnosticMap[diagnostic] = TextDiagnostic.asTextDiagnostic(diagnostic)
            }

            return diagnosticMap
        }
}

class TextDiagnosticDescriptor internal constructor(private val positionalTextDiagnostic: PositionalTextDiagnostic) :
    AbstractDiagnosticDescriptor(positionalTextDiagnostic.start, positionalTextDiagnostic.end) {

    val textDiagnostic: TextDiagnostic
        get() = positionalTextDiagnostic.diagnostic
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy