From 9d6ae2e29907c5efbc20339a033594acc8088f2b Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 26 Sep 2018 17:41:35 +0200 Subject: [PATCH] Change deprecated 'operator mod' to 'rem' --- .../org/jetbrains/uast/values/UConstant.kt | 28 +++++-------------- .../jetbrains/uast/values/UDependentValue.kt | 18 ++---------- .../src/org/jetbrains/uast/values/UOperand.kt | 18 ++---------- .../org/jetbrains/uast/values/UValueBase.kt | 18 ++---------- 4 files changed, 13 insertions(+), 69 deletions(-) diff --git a/uast/uast-common/src/org/jetbrains/uast/values/UConstant.kt b/uast/uast-common/src/org/jetbrains/uast/values/UConstant.kt index 786f319880a7..f5d1e8bd5f60 100644 --- a/uast/uast-common/src/org/jetbrains/uast/values/UConstant.kt +++ b/uast/uast-common/src/org/jetbrains/uast/values/UConstant.kt @@ -1,18 +1,4 @@ -/* - * Copyright 2000-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 file. package org.jetbrains.uast.values import com.intellij.psi.PsiEnumConstant @@ -124,11 +110,11 @@ class UIntConstant( else -> super.div(other) } - override fun mod(other: UValue): UValue = when (other) { + override fun rem(other: UValue): UValue = when (other) { is UIntConstant -> UIntConstant(value % other.value, type.merge(other.type)) is ULongConstant -> ULongConstant(value % other.value) is UFloatConstant -> UFloatConstant.create(value % other.value, type.merge(other.type)) - else -> super.mod(other) + else -> super.rem(other) } override fun unaryMinus(): UIntConstant = UIntConstant(-value, type) @@ -197,11 +183,11 @@ class ULongConstant(override val value: Long, source: ULiteralExpression? = null else -> super.div(other) } - override fun mod(other: UValue): UValue = when (other) { + override fun rem(other: UValue): UValue = when (other) { is ULongConstant -> ULongConstant(value % other.value) is UIntConstant -> ULongConstant(value % other.value) is UFloatConstant -> UFloatConstant.create(value % other.value, type.merge(other.type)) - else -> super.mod(other) + else -> super.rem(other) } override fun unaryMinus(): ULongConstant = ULongConstant(-value) @@ -273,11 +259,11 @@ open class UFloatConstant protected constructor( else -> super.div(other) } - override fun mod(other: UValue): UValue = when (other) { + override fun rem(other: UValue): UValue = when (other) { is ULongConstant -> create(value % other.value, type.merge(other.type)) is UIntConstant -> create(value % other.value, type.merge(other.type)) is UFloatConstant -> create(value % other.value, type.merge(other.type)) - else -> super.mod(other) + else -> super.rem(other) } override fun greater(other: UValue): UValue = when (other) { diff --git a/uast/uast-common/src/org/jetbrains/uast/values/UDependentValue.kt b/uast/uast-common/src/org/jetbrains/uast/values/UDependentValue.kt index 33e03b464b3f..a2daed33c1df 100644 --- a/uast/uast-common/src/org/jetbrains/uast/values/UDependentValue.kt +++ b/uast/uast-common/src/org/jetbrains/uast/values/UDependentValue.kt @@ -1,18 +1,4 @@ -/* - * Copyright 2000-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 file. package org.jetbrains.uast.values open class UDependentValue protected constructor( @@ -45,7 +31,7 @@ open class UDependentValue protected constructor( internal fun inverseDiv(other: UValue) = wrapBinary(other.unwrap() / unwrap(), other) - override fun mod(other: UValue): UValue = wrapBinary(unwrap() % other.unwrap(), other) + override fun rem(other: UValue): UValue = wrapBinary(unwrap() % other.unwrap(), other) internal fun inverseMod(other: UValue) = wrapBinary(other.unwrap() % unwrap(), other) diff --git a/uast/uast-common/src/org/jetbrains/uast/values/UOperand.kt b/uast/uast-common/src/org/jetbrains/uast/values/UOperand.kt index d4ed151e8ef8..ebf850b6cd80 100644 --- a/uast/uast-common/src/org/jetbrains/uast/values/UOperand.kt +++ b/uast/uast-common/src/org/jetbrains/uast/values/UOperand.kt @@ -1,18 +1,4 @@ -/* - * Copyright 2000-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 file. package org.jetbrains.uast.values interface UOperand { @@ -24,7 +10,7 @@ interface UOperand { operator fun div(other: UValue): UValue - operator fun mod(other: UValue): UValue + operator fun rem(other: UValue): UValue operator fun unaryMinus(): UValue diff --git a/uast/uast-common/src/org/jetbrains/uast/values/UValueBase.kt b/uast/uast-common/src/org/jetbrains/uast/values/UValueBase.kt index d48f7f4c64db..cb380bf60f60 100644 --- a/uast/uast-common/src/org/jetbrains/uast/values/UValueBase.kt +++ b/uast/uast-common/src/org/jetbrains/uast/values/UValueBase.kt @@ -1,18 +1,4 @@ -/* - * Copyright 2000-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 file. package org.jetbrains.uast.values abstract class UValueBase : UValue { @@ -28,7 +14,7 @@ abstract class UValueBase : UValue { override operator fun div(other: UValue): UValue = (other as? UDependentValue)?.inverseDiv(this) ?: UUndeterminedValue - override operator fun mod(other: UValue): UValue = + override operator fun rem(other: UValue): UValue = (other as? UDependentValue)?.inverseMod(this) ?: UUndeterminedValue override fun unaryMinus(): UValue = UUndeterminedValue