Minor: move utilities closer to their only usage
This commit is contained in:
+10
@@ -531,6 +531,16 @@ private class ConstantExpressionEvaluatorVisitor(private val trace: BindingTrace
|
|||||||
else -> factory.createLongValue(value)
|
else -> factory.createLongValue(value)
|
||||||
}.wrap(parameters)
|
}.wrap(parameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun <T> ConstantValue<T>.wrap(parameters: CompileTimeConstant.Parameters): TypedCompileTimeConstant<T>
|
||||||
|
= TypedCompileTimeConstant(this, parameters)
|
||||||
|
|
||||||
|
private fun <T> ConstantValue<T>.wrap(
|
||||||
|
canBeUsedInAnnotation: Boolean = this !is NullValue,
|
||||||
|
isPure: Boolean = false,
|
||||||
|
usesVariableAsConstant: Boolean = false
|
||||||
|
): TypedCompileTimeConstant<T>
|
||||||
|
= wrap(CompileTimeConstant.Parameters(canBeUsedInAnnotation, isPure, usesVariableAsConstant))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hasLongSuffix(text: String) = text.endsWith('l') || text.endsWith('L')
|
private fun hasLongSuffix(text: String) = text.endsWith('l') || text.endsWith('L')
|
||||||
|
|||||||
@@ -55,16 +55,6 @@ public class TypedCompileTimeConstant<out T>(
|
|||||||
override fun toConstantValue(expectedType: JetType): ConstantValue<T> = constantValue
|
override fun toConstantValue(expectedType: JetType): ConstantValue<T> = constantValue
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun <T> ConstantValue<T>.wrap(parameters: CompileTimeConstant.Parameters): TypedCompileTimeConstant<T>
|
|
||||||
= TypedCompileTimeConstant(this, parameters)
|
|
||||||
|
|
||||||
public fun <T> ConstantValue<T>.wrap(
|
|
||||||
canBeUsedInAnnotation: Boolean = this !is NullValue,
|
|
||||||
isPure: Boolean = false,
|
|
||||||
usesVariableAsConstant: Boolean = false
|
|
||||||
): TypedCompileTimeConstant<T>
|
|
||||||
= wrap(CompileTimeConstant.Parameters(canBeUsedInAnnotation, isPure, usesVariableAsConstant))
|
|
||||||
|
|
||||||
public class IntegerValueTypeConstant(
|
public class IntegerValueTypeConstant(
|
||||||
private val value: Number,
|
private val value: Number,
|
||||||
override val parameters: CompileTimeConstant.Parameters
|
override val parameters: CompileTimeConstant.Parameters
|
||||||
|
|||||||
Reference in New Issue
Block a user