Migrate CompileTimeType and OperationsMap to frontend.common
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.resolve.constants.evaluate
|
||||
|
||||
enum class CompileTimeType {
|
||||
BYTE,
|
||||
SHORT,
|
||||
INT,
|
||||
LONG,
|
||||
DOUBLE,
|
||||
FLOAT,
|
||||
CHAR,
|
||||
BOOLEAN,
|
||||
STRING,
|
||||
ANY
|
||||
}
|
||||
+3
-4
@@ -11,7 +11,7 @@ import java.math.BigInteger
|
||||
|
||||
/** This file is generated by `./gradlew generateOperationsMap`. DO NOT MODIFY MANUALLY */
|
||||
|
||||
internal fun evalUnaryOp(name: String, type: CompileTimeType, value: Any): Any? {
|
||||
fun evalUnaryOp(name: String, type: CompileTimeType, value: Any): Any? {
|
||||
when (type) {
|
||||
BOOLEAN -> when (name) {
|
||||
"not" -> return (value as Boolean).not()
|
||||
@@ -110,8 +110,7 @@ internal fun evalUnaryOp(name: String, type: CompileTimeType, value: Any): Any?
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
internal fun evalBinaryOp(name: String, leftType: CompileTimeType, left: Any, rightType: CompileTimeType, right: Any): Any? {
|
||||
fun evalBinaryOp(name: String, leftType: CompileTimeType, left: Any, rightType: CompileTimeType, right: Any): Any? {
|
||||
when (leftType) {
|
||||
BOOLEAN -> when (rightType) {
|
||||
BOOLEAN -> when (name) {
|
||||
@@ -519,7 +518,7 @@ internal fun evalBinaryOp(name: String, leftType: CompileTimeType, left: Any, ri
|
||||
return null
|
||||
}
|
||||
|
||||
internal fun checkBinaryOp(
|
||||
fun checkBinaryOp(
|
||||
name: String, leftType: CompileTimeType, left: BigInteger, rightType: CompileTimeType, right: BigInteger
|
||||
): BigInteger? {
|
||||
when (leftType) {
|
||||
-6
@@ -12,7 +12,6 @@ import com.intellij.psi.util.TypeConversionUtil
|
||||
import org.jetbrains.kotlin.KtNodeTypes
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.builtins.StandardNames
|
||||
import org.jetbrains.kotlin.builtins.UnsignedType
|
||||
import org.jetbrains.kotlin.builtins.UnsignedTypes
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersionSettings
|
||||
@@ -1140,11 +1139,6 @@ private fun getReceiverExpressionType(resolvedCall: ResolvedCall<*>): KotlinType
|
||||
}
|
||||
}
|
||||
|
||||
internal enum class CompileTimeType {
|
||||
BYTE, SHORT, INT, LONG, DOUBLE, FLOAT, CHAR, BOOLEAN,
|
||||
STRING, ANY
|
||||
}
|
||||
|
||||
fun ConstantValue<*>.isStandaloneOnlyConstant(): Boolean {
|
||||
return this is KClassValue || this is EnumValue || this is AnnotationValue || this is ArrayValue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user