From b0ee61620c22d1513013c58acd491913effcdc49 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Mon, 5 Feb 2018 04:13:43 +0300 Subject: [PATCH] Add `KotlinType` to methods `coerceTo` & `coerceFrom` --- .../codegen/BoxedVsPrimitiveBranchedValues.kt | 2 +- .../jetbrains/kotlin/codegen/BranchedValue.kt | 6 +- .../kotlin/codegen/MemberCodegen.java | 17 +---- .../jetbrains/kotlin/codegen/StackValue.java | 66 +++++++++---------- .../jetbrains/kotlin/codegen/StackValue.kt | 2 +- .../CallBasedInExpressionGenerator.kt | 2 +- 6 files changed, 42 insertions(+), 53 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/BoxedVsPrimitiveBranchedValues.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/BoxedVsPrimitiveBranchedValues.kt index 0723cbc2027..849985c544a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/BoxedVsPrimitiveBranchedValues.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/BoxedVsPrimitiveBranchedValues.kt @@ -74,7 +74,7 @@ abstract class SafeCallFusedWithPrimitiveEqualityBase( v.iconst(0) v.mark(endLabel) - coerceTo(type, v) + coerceTo(type, kotlinType, v) } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/BranchedValue.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/BranchedValue.kt index d0ce93968d9..3828da68046 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/BranchedValue.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/BranchedValue.kt @@ -31,7 +31,7 @@ open class BranchedValue( v.visitLabel(branchJumpLabel) v.iconst(0) v.visitLabel(endLabel) - coerceTo(type, v) + coerceTo(type, kotlinType, v) } open fun condJump(jumpLabel: Label, v: InstructionAdapter, jumpIfFalse: Boolean) { @@ -67,7 +67,7 @@ open class BranchedValue( override fun putSelector(type: Type, kotlinType: KotlinType?, v: InstructionAdapter) { v.iconst(1) - coerceTo(type, v) + coerceTo(type, kotlinType, v) } } @@ -89,7 +89,7 @@ open class BranchedValue( override fun putSelector(type: Type, kotlinType: KotlinType?, v: InstructionAdapter) { v.iconst(0) - coerceTo(type, v) + coerceTo(type, kotlinType, v) } } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java index ec3e4e701f2..7f84ed414a7 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java @@ -1,17 +1,6 @@ /* - * Copyright 2010-2017 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 2000-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.codegen; @@ -728,7 +717,7 @@ public abstract class MemberCodegen