Minor: move utilities closer to their only usage

This commit is contained in:
Pavel V. Talanov
2015-07-16 19:37:48 +03:00
parent f2016c8033
commit a84da2bb0c
2 changed files with 10 additions and 10 deletions
@@ -531,6 +531,16 @@ private class ConstantExpressionEvaluatorVisitor(private val trace: BindingTrace
else -> factory.createLongValue(value)
}.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')
@@ -55,16 +55,6 @@ public class TypedCompileTimeConstant<out T>(
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(
private val value: Number,
override val parameters: CompileTimeConstant.Parameters