IrTypes: fix ir2cfg

(cherry picked from commit cf162c7)
This commit is contained in:
Zalim Bashorov
2018-06-09 21:43:29 +03:00
committed by Dmitry Petrov
parent ea7b344b80
commit 49f2598907
@@ -1,28 +1,16 @@
/*
* Copyright 2010-2016 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.
* Copyright 2010-2018 JetBrains s.r.o. 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.ir2cfg.generators
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.ir.IrElement
import org.jetbrains.kotlin.ir.IrStatement
import org.jetbrains.kotlin.ir.declarations.IrFunction
import org.jetbrains.kotlin.ir.declarations.IrVariable
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.types.impl.originalKotlinType
import org.jetbrains.kotlin.ir.types.isNothing
import org.jetbrains.kotlin.ir.util.dump
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
import org.jetbrains.kotlin.ir2cfg.graph.ControlFlowGraph
@@ -67,8 +55,7 @@ class FunctionGenerator(val function: IrFunction) {
return result
}
private fun IrElement?.isNothing() =
this is IrExpression && KotlinBuiltIns.isNothing(type.originalKotlinType!!) // TODO
private fun IrElement?.isNothing() = this is IrExpression && type.isNothing()
override fun visitBlockBody(body: IrBlockBody, data: Boolean): IrStatement? {
return body.process()