Change deprecated 'operator mod' to 'rem'

This commit is contained in:
Dmitry Jemerov
2018-09-26 17:42:58 +02:00
parent fec43a0d47
commit 9d6ae2e299
4 changed files with 13 additions and 69 deletions
@@ -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) {
@@ -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)
@@ -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
@@ -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