summaryrefslogtreecommitdiff
path: root/plugins/kotlin/uast/uast-kotlin-base/src/org/jetbrains/uast/kotlin/controlStructures/KotlinUTryExpression.kt
blob: b5594ac94f6ff7f9c55b43a491e01fd3a0a3ebc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.

package org.jetbrains.uast.kotlin

import org.jetbrains.annotations.ApiStatus
import org.jetbrains.kotlin.psi.KtTryExpression
import org.jetbrains.uast.*

@ApiStatus.Internal
class KotlinUTryExpression(
    override val sourcePsi: KtTryExpression,
    givenParent: UElement?
) : KotlinAbstractUExpression(givenParent), UTryExpression, KotlinUElementWithType {
    override val tryClause by lz {
        baseResolveProviderService.baseKotlinConverter.convertOrEmpty(sourcePsi.tryBlock, this)
    }
    override val catchClauses by lz {
        sourcePsi.catchClauses.map { KotlinUCatchClause(it, this) }
    }
    override val finallyClause by lz {
        sourcePsi.finallyBlock?.finalExpression?.let {
            baseResolveProviderService.baseKotlinConverter.convertExpression(it, this, DEFAULT_EXPRESSION_TYPES_LIST)
        }
    }

    override val resourceVariables: List<UVariable>
        get() = emptyList()

    override val hasResources: Boolean
        get() = false

    override val tryIdentifier: UIdentifier
        get() = KotlinUIdentifier(null, this)

    override val finallyIdentifier: UIdentifier?
        get() = null
}