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

org.jetbrains.kotlin.cfg.ControlFlowBuilderAdapter.kt Maven / Gradle / Ivy

There is a newer version: 2.1.0-Beta1
Show newest version
/*
 * Copyright 2010-2015 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.kotlin.cfg

import org.jetbrains.kotlin.cfg.pseudocode.PseudoValue
import org.jetbrains.kotlin.cfg.pseudocode.Pseudocode
import org.jetbrains.kotlin.cfg.pseudocode.instructions.eval.*
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue

abstract class ControlFlowBuilderAdapter : ControlFlowBuilder {

    protected abstract val delegateBuilder: ControlFlowBuilder

    override fun loadUnit(expression: KtExpression) {
        delegateBuilder.loadUnit(expression)
    }

    override fun loadConstant(expression: KtExpression, constant: CompileTimeConstant<*>?): InstructionWithValue {
        return delegateBuilder.loadConstant(expression, constant)
    }

    override fun createAnonymousObject(expression: KtObjectLiteralExpression): InstructionWithValue {
        return delegateBuilder.createAnonymousObject(expression)
    }

    override fun createLambda(expression: KtFunction): InstructionWithValue {
        return delegateBuilder.createLambda(expression)
    }

    override fun loadStringTemplate(expression: KtStringTemplateExpression, inputValues: List): InstructionWithValue {
        return delegateBuilder.loadStringTemplate(expression, inputValues)
    }

    override fun magic(
            instructionElement: KtElement,
            valueElement: KtElement?,
            inputValues: List,
            kind: MagicKind): MagicInstruction {
        return delegateBuilder.magic(instructionElement, valueElement, inputValues, kind)
    }

    override fun merge(expression: KtExpression, inputValues: List): MergeInstruction {
        return delegateBuilder.merge(expression, inputValues)
    }

    override fun readVariable(
            expression: KtExpression,
            resolvedCall: ResolvedCall<*>,
            receiverValues: Map): ReadValueInstruction {
        return delegateBuilder.readVariable(expression, resolvedCall, receiverValues)
    }

    override fun call(
            valueElement: KtElement,
            resolvedCall: ResolvedCall<*>,
            receiverValues: Map,
            arguments: Map): CallInstruction {
        return delegateBuilder.call(valueElement, resolvedCall, receiverValues, arguments)
    }

    override fun predefinedOperation(
            expression: KtExpression,
            operation: ControlFlowBuilder.PredefinedOperation,
            inputValues: List): OperationInstruction {
        return delegateBuilder.predefinedOperation(expression, operation, inputValues)
    }

    override fun createUnboundLabel(): Label {
        return delegateBuilder.createUnboundLabel()
    }

    override fun createUnboundLabel(name: String): Label {
        return delegateBuilder.createUnboundLabel(name)
    }

    override fun bindLabel(label: Label) {
        delegateBuilder.bindLabel(label)
    }

    override fun jump(label: Label, element: KtElement) {
        delegateBuilder.jump(label, element)
    }

    override fun jumpOnFalse(label: Label, element: KtElement, conditionValue: PseudoValue?) {
        delegateBuilder.jumpOnFalse(label, element, conditionValue)
    }

    override fun jumpOnTrue(label: Label, element: KtElement, conditionValue: PseudoValue?) {
        delegateBuilder.jumpOnTrue(label, element, conditionValue)
    }

    override fun nondeterministicJump(label: Label, element: KtElement, inputValue: PseudoValue?) {
        delegateBuilder.nondeterministicJump(label, element, inputValue)
    }

    override fun nondeterministicJump(label: List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy