org.jetbrains.kotlin.ir.types.impl.IrTypeAbbreviationImpl.kt Maven / Gradle / Ivy
/*
* 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.ir.types.impl
import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.symbols.IrTypeAliasSymbol
import org.jetbrains.kotlin.ir.types.IrTypeAbbreviation
import org.jetbrains.kotlin.ir.types.IrTypeArgument
class IrTypeAbbreviationImpl(
override val typeAlias: IrTypeAliasSymbol,
override val hasQuestionMark: Boolean,
override val arguments: List,
override val annotations: List
) : IrTypeAbbreviation
class IrTypeAbbreviationBuilder {
var typeAlias: IrTypeAliasSymbol? = null
var hasQuestionMark: Boolean = false
var arguments: List = emptyList()
var annotations: List = emptyList()
}
fun IrTypeAbbreviationImpl.toBuilder() =
IrTypeAbbreviationBuilder().also { b ->
b.typeAlias = typeAlias
b.hasQuestionMark = hasQuestionMark
b.arguments = arguments
b.annotations = annotations
}
fun IrTypeAbbreviationBuilder.build() =
IrTypeAbbreviationImpl(
typeAlias ?: throw AssertionError("typeAlias not provided"),
hasQuestionMark, arguments, annotations
)