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

org.jetbrains.kotlin.contracts.description.KtContractDescriptionVisitor.kt Maven / Gradle / Ivy

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


abstract class KtContractDescriptionVisitor {
    open fun visitContractDescriptionElement(contractDescriptionElement: KtContractDescriptionElement, data: D): R {
        throw IllegalStateException("Top of hierarchy reached, no overloads were found for element: $contractDescriptionElement")
    }

    // Effects
    open fun visitEffectDeclaration(effectDeclaration: KtEffectDeclaration, data: D): R = visitContractDescriptionElement(effectDeclaration, data)

    open fun visitConditionalEffectDeclaration(conditionalEffect: KtConditionalEffectDeclaration, data: D): R =
        visitEffectDeclaration(conditionalEffect, data)

    open fun visitReturnsEffectDeclaration(returnsEffect: KtReturnsEffectDeclaration, data: D): R =
        visitEffectDeclaration(returnsEffect, data)

    open fun visitCallsEffectDeclaration(callsEffect: KtCallsEffectDeclaration, data: D): R =
        visitEffectDeclaration(callsEffect, data)

    open fun visitErroneousCallsEffectDeclaration(callsEffect: KtErroneousCallsEffectDeclaration, data: D): R =
        visitCallsEffectDeclaration(callsEffect, data)

    // Expressions
    open fun visitBooleanExpression(booleanExpression: KtBooleanExpression, data: D): R =
        visitContractDescriptionElement(booleanExpression, data)

    open fun visitLogicalBinaryOperationContractExpression(binaryLogicExpression: KtBinaryLogicExpression, data: D): R =
        visitBooleanExpression(binaryLogicExpression, data)

    open fun visitLogicalNot(logicalNot: KtLogicalNot, data: D): R = visitBooleanExpression(logicalNot, data)

    open fun visitIsInstancePredicate(isInstancePredicate: KtIsInstancePredicate, data: D): R =
        visitBooleanExpression(isInstancePredicate, data)

    open fun visitErroneousIsInstancePredicate(isInstancePredicate: KtErroneousIsInstancePredicate, data: D): R =
        visitIsInstancePredicate(isInstancePredicate, data)

    open fun visitIsNullPredicate(isNullPredicate: KtIsNullPredicate, data: D): R = visitBooleanExpression(isNullPredicate, data)

    // Values
    open fun visitValue(value: KtContractDescriptionValue, data: D): R = visitContractDescriptionElement(value, data)

    open fun visitConstantDescriptor(constantReference: KtConstantReference, data: D): R = visitValue(constantReference, data)

    open fun visitBooleanConstantDescriptor(booleanConstantDescriptor: KtBooleanConstantReference, data: D): R =
        visitConstantDescriptor(booleanConstantDescriptor, data)

    open fun visitErroneousConstantReference(erroneousConstantReference: KtErroneousConstantReference, data: D): R =
        visitConstantDescriptor(erroneousConstantReference, data)

    open fun visitValueParameterReference(valueParameterReference: KtValueParameterReference, data: D): R =
        visitValue(valueParameterReference, data)

    open fun visitBooleanValueParameterReference(booleanValueParameterReference: KtBooleanValueParameterReference, data: D): R =
        visitValueParameterReference(booleanValueParameterReference, data)

    open fun visitErroneousValueParameterReference(valueParameterReference: KtErroneousValueParameterReference, data: D): R =
        visitValueParameterReference(valueParameterReference, data)

    // Error
    open fun visitErroneousElement(element: KtErroneousContractElement, data: D): R =
        visitContractDescriptionElement(element, data)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy