Migrate deprecations in core, compiler, idea, tests
Replacing deprecated Char.toInt() with Char.code and Number.toChar() with Number.toInt().toChar(), where Number is not Int. KT-23451
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ fun mangleNameIfNeeded(name: String): String {
|
|||||||
if (c.isValidCharacter()) {
|
if (c.isValidCharacter()) {
|
||||||
append(c)
|
append(c)
|
||||||
} else {
|
} else {
|
||||||
val hexString = Integer.toHexString(c.toInt())
|
val hexString = Integer.toHexString(c.code)
|
||||||
assert(hexString.length <= 4)
|
assert(hexString.length <= 4)
|
||||||
append("_u").append(hexString)
|
append("_u").append(hexString)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -131,7 +131,7 @@ abstract class PrimitiveNumberRangeIntrinsicRangeValue(
|
|||||||
if (isProhibitedCharConstEndValue(step, endCharValue))
|
if (isProhibitedCharConstEndValue(step, endCharValue))
|
||||||
null
|
null
|
||||||
else
|
else
|
||||||
createConstBoundedIntForLoopGenerator(codegen, forExpression, startValue, endCharValue.toInt(), step, isStartInclusive)
|
createConstBoundedIntForLoopGenerator(codegen, forExpression, startValue, endCharValue.code, step, isStartInclusive)
|
||||||
}
|
}
|
||||||
|
|
||||||
is LongValue -> {
|
is LongValue -> {
|
||||||
|
|||||||
+2
-2
@@ -140,8 +140,8 @@ private fun jsonEscape(value: String): String = buildString {
|
|||||||
'\r' -> append("\\r")
|
'\r' -> append("\\r")
|
||||||
'\"' -> append("\\\"")
|
'\"' -> append("\\\"")
|
||||||
'\\' -> append("\\\\")
|
'\\' -> append("\\\\")
|
||||||
else -> if (ch.toInt() < 32) {
|
else -> if (ch.code < 32) {
|
||||||
append("\\u" + Integer.toHexString(ch.toInt()).padStart(4, '0'))
|
append("\\u" + Integer.toHexString(ch.code).padStart(4, '0'))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
append(ch)
|
append(ch)
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class LogStream(name: String) : OutputStream() {
|
|||||||
val lineBuf = StringBuilder()
|
val lineBuf = StringBuilder()
|
||||||
|
|
||||||
override fun write(byte: Int) {
|
override fun write(byte: Int) {
|
||||||
if (byte.toChar() == '\n') flush()
|
if (byte == '\n'.code) flush()
|
||||||
else lineBuf.append(byte.toChar())
|
else lineBuf.append(byte.toChar())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -243,7 +243,7 @@ abstract class AbstractAnnotationDeserializer(
|
|||||||
const(kind, value.intValue)
|
const(kind, value.intValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
CHAR -> const(ConstantValueKind.Char, value.intValue.toChar())
|
CHAR -> const(ConstantValueKind.Char, value.intValue.toInt().toChar())
|
||||||
FLOAT -> const(ConstantValueKind.Float, value.floatValue)
|
FLOAT -> const(ConstantValueKind.Float, value.floatValue)
|
||||||
DOUBLE -> const(ConstantValueKind.Double, value.doubleValue)
|
DOUBLE -> const(ConstantValueKind.Double, value.doubleValue)
|
||||||
BOOLEAN -> const(ConstantValueKind.Boolean, (value.intValue != 0L))
|
BOOLEAN -> const(ConstantValueKind.Boolean, (value.intValue != 0L))
|
||||||
|
|||||||
+1
-1
@@ -54,7 +54,7 @@ class FirConstDeserializer(
|
|||||||
): FirExpression? {
|
): FirExpression? {
|
||||||
return when (constKind) {
|
return when (constKind) {
|
||||||
"BYTE", "B" -> buildConstExpression(null, ConstantValueKind.Byte, ((protoValue?.intValue ?: sourceValue) as Number).toByte())
|
"BYTE", "B" -> buildConstExpression(null, ConstantValueKind.Byte, ((protoValue?.intValue ?: sourceValue) as Number).toByte())
|
||||||
"CHAR", "C" -> buildConstExpression(null, ConstantValueKind.Char, ((protoValue?.intValue ?: sourceValue) as Number).toChar())
|
"CHAR", "C" -> buildConstExpression(null, ConstantValueKind.Char, ((protoValue?.intValue ?: sourceValue) as Number).toInt().toChar())
|
||||||
"SHORT", "S" -> buildConstExpression(null, ConstantValueKind.Short, ((protoValue?.intValue ?: sourceValue) as Number).toShort())
|
"SHORT", "S" -> buildConstExpression(null, ConstantValueKind.Short, ((protoValue?.intValue ?: sourceValue) as Number).toShort())
|
||||||
"INT", "I" -> buildConstExpression(null, ConstantValueKind.Int, protoValue?.intValue?.toInt() ?: sourceValue as Int)
|
"INT", "I" -> buildConstExpression(null, ConstantValueKind.Int, protoValue?.intValue?.toInt() ?: sourceValue as Int)
|
||||||
"LONG", "J" -> buildConstExpression(null, ConstantValueKind.Long, protoValue?.intValue ?: sourceValue as Long)
|
"LONG", "J" -> buildConstExpression(null, ConstantValueKind.Long, protoValue?.intValue ?: sourceValue as Long)
|
||||||
|
|||||||
+1
-1
@@ -35,7 +35,7 @@ internal object FirAnnotationArgumentVisitor : AnnotationArgumentVisitor<Unit, F
|
|||||||
|
|
||||||
override fun visitCharValue(value: CharValue, data: FirAnnotationArgumentVisitorData) {
|
override fun visitCharValue(value: CharValue, data: FirAnnotationArgumentVisitorData) {
|
||||||
data.builder.type = ProtoBuf.Annotation.Argument.Value.Type.CHAR
|
data.builder.type = ProtoBuf.Annotation.Argument.Value.Type.CHAR
|
||||||
data.builder.intValue = value.value.toLong()
|
data.builder.intValue = value.value.code.toLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitDoubleValue(value: DoubleValue, data: FirAnnotationArgumentVisitorData) {
|
override fun visitDoubleValue(value: DoubleValue, data: FirAnnotationArgumentVisitorData) {
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ internal class ByteValue(value: Byte) : IntegerValueConstant<Byte>(value) {
|
|||||||
internal class CharValue(value: Char) : IntegerValueConstant<Char>(value) {
|
internal class CharValue(value: Char) : IntegerValueConstant<Char>(value) {
|
||||||
override fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D): R = visitor.visitCharValue(this, data)
|
override fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D): R = visitor.visitCharValue(this, data)
|
||||||
|
|
||||||
override fun toString(): String = "\\u%04X ('%s')".format(value.toInt(), getPrintablePart(value))
|
override fun toString(): String = "\\u%04X ('%s')".format(value.code, getPrintablePart(value))
|
||||||
|
|
||||||
private fun getPrintablePart(c: Char): String = when (c) {
|
private fun getPrintablePart(c: Char): String = when (c) {
|
||||||
'\b' -> "\\b"
|
'\b' -> "\\b"
|
||||||
|
|||||||
@@ -847,10 +847,10 @@ class FirRenderer(builder: StringBuilder, private val mode: RenderMode = RenderM
|
|||||||
if (value !is Char) {
|
if (value !is Char) {
|
||||||
print(value.toString())
|
print(value.toString())
|
||||||
} else {
|
} else {
|
||||||
if (value.toInt() in 32..127) {
|
if (value.code in 32..127) {
|
||||||
print(value)
|
print(value)
|
||||||
} else {
|
} else {
|
||||||
print(value.toInt())
|
print(value.code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print(")")
|
print(")")
|
||||||
|
|||||||
+2
-2
@@ -82,8 +82,8 @@ internal class CharProgressionType(symbols: Symbols<CommonBackendContext>) :
|
|||||||
ProgressionType(
|
ProgressionType(
|
||||||
elementClass = symbols.char.owner,
|
elementClass = symbols.char.owner,
|
||||||
stepClass = symbols.int.owner,
|
stepClass = symbols.int.owner,
|
||||||
minValueAsLong = Char.MIN_VALUE.toLong(),
|
minValueAsLong = Char.MIN_VALUE.code.toLong(),
|
||||||
maxValueAsLong = Char.MAX_VALUE.toLong(),
|
maxValueAsLong = Char.MAX_VALUE.code.toLong(),
|
||||||
// Uses `getProgressionLastElement(Int, Int, Int): Int`
|
// Uses `getProgressionLastElement(Int, Int, Int): Int`
|
||||||
getProgressionLastElementFunction = symbols.getProgressionLastElementByReturnType[symbols.int]
|
getProgressionLastElementFunction = symbols.getProgressionLastElementByReturnType[symbols.int]
|
||||||
) {
|
) {
|
||||||
|
|||||||
+1
-1
@@ -76,7 +76,7 @@ internal val IrExpression.canHaveSideEffects: Boolean
|
|||||||
private fun Any?.toLong(): Long? =
|
private fun Any?.toLong(): Long? =
|
||||||
when (this) {
|
when (this) {
|
||||||
is Number -> toLong()
|
is Number -> toLong()
|
||||||
is Char -> toLong()
|
is Char -> code.toLong()
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@ class ConstTransformer(private val context: JsIrBackendContext) : IrElementTrans
|
|||||||
}
|
}
|
||||||
return when {
|
return when {
|
||||||
expression.kind is IrConstKind.Char ->
|
expression.kind is IrConstKind.Char ->
|
||||||
lowerConst(charClassSymbol, IrConstImpl.Companion::int, IrConstKind.Char.valueOf(expression).toInt())
|
lowerConst(charClassSymbol, IrConstImpl.Companion::int, IrConstKind.Char.valueOf(expression).code)
|
||||||
|
|
||||||
expression.kind is IrConstKind.Long ->
|
expression.kind is IrConstKind.Long ->
|
||||||
createLong(IrConstKind.Long.valueOf(expression))
|
createLong(IrConstKind.Long.valueOf(expression))
|
||||||
|
|||||||
+2
-2
@@ -736,7 +736,7 @@ class ExpressionCodegen(
|
|||||||
private fun isDefaultValueForType(type: Type, value: Any?): Boolean =
|
private fun isDefaultValueForType(type: Type, value: Any?): Boolean =
|
||||||
when (type) {
|
when (type) {
|
||||||
Type.BOOLEAN_TYPE -> value is Boolean && !value
|
Type.BOOLEAN_TYPE -> value is Boolean && !value
|
||||||
Type.CHAR_TYPE -> value is Char && value.toInt() == 0
|
Type.CHAR_TYPE -> value is Char && value.code == 0
|
||||||
Type.BYTE_TYPE, Type.SHORT_TYPE, Type.INT_TYPE, Type.LONG_TYPE -> value is Number && value.toLong() == 0L
|
Type.BYTE_TYPE, Type.SHORT_TYPE, Type.INT_TYPE, Type.LONG_TYPE -> value is Number && value.toLong() == 0L
|
||||||
// Must use `equals` for these two to differentiate between +0.0 and -0.0:
|
// Must use `equals` for these two to differentiate between +0.0 and -0.0:
|
||||||
Type.FLOAT_TYPE -> value is Number && value.toFloat().equals(0.0f)
|
Type.FLOAT_TYPE -> value is Number && value.toFloat().equals(0.0f)
|
||||||
@@ -836,7 +836,7 @@ class ExpressionCodegen(
|
|||||||
mv.nop()
|
mv.nop()
|
||||||
return BooleanConstant(this, value)
|
return BooleanConstant(this, value)
|
||||||
}
|
}
|
||||||
is Char -> mv.iconst(value.toInt())
|
is Char -> mv.iconst(value.code)
|
||||||
is Long -> mv.lconst(value)
|
is Long -> mv.lconst(value)
|
||||||
is Float -> mv.fconst(value)
|
is Float -> mv.fconst(value)
|
||||||
is Double -> mv.dconst(value)
|
is Double -> mv.dconst(value)
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ class BodyGenerator(val context: WasmFunctionCodegenContext) : IrElementVisitorV
|
|||||||
is IrConstKind.Short -> body.buildConstI32(kind.valueOf(expression).toInt())
|
is IrConstKind.Short -> body.buildConstI32(kind.valueOf(expression).toInt())
|
||||||
is IrConstKind.Int -> body.buildConstI32(kind.valueOf(expression))
|
is IrConstKind.Int -> body.buildConstI32(kind.valueOf(expression))
|
||||||
is IrConstKind.Long -> body.buildConstI64(kind.valueOf(expression))
|
is IrConstKind.Long -> body.buildConstI64(kind.valueOf(expression))
|
||||||
is IrConstKind.Char -> body.buildConstI32(kind.valueOf(expression).toInt())
|
is IrConstKind.Char -> body.buildConstI32(kind.valueOf(expression).code)
|
||||||
is IrConstKind.Float -> body.buildConstF32(kind.valueOf(expression))
|
is IrConstKind.Float -> body.buildConstF32(kind.valueOf(expression))
|
||||||
is IrConstKind.Double -> body.buildConstF64(kind.valueOf(expression))
|
is IrConstKind.Double -> body.buildConstF64(kind.valueOf(expression))
|
||||||
is IrConstKind.String -> {
|
is IrConstKind.String -> {
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.ir.interpreter.state.*
|
|||||||
|
|
||||||
/** This file is generated by org.jetbrains.kotlin.backend.common.interpreter.builtins.GenerateBuiltInsMap.generateMap(). DO NOT MODIFY MANUALLY */
|
/** This file is generated by org.jetbrains.kotlin.backend.common.interpreter.builtins.GenerateBuiltInsMap.generateMap(). DO NOT MODIFY MANUALLY */
|
||||||
|
|
||||||
@Suppress("DEPRECATION_ERROR")
|
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
|
||||||
val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||||
unaryOperation<Boolean>("hashCode", "Boolean") { a -> a.hashCode() },
|
unaryOperation<Boolean>("hashCode", "Boolean") { a -> a.hashCode() },
|
||||||
unaryOperation<Boolean>("not", "Boolean") { a -> a.not() },
|
unaryOperation<Boolean>("not", "Boolean") { a -> a.not() },
|
||||||
|
|||||||
+1
-1
@@ -580,7 +580,7 @@ open class IrFileSerializer(
|
|||||||
IrConstKind.Null -> proto.`null` = true
|
IrConstKind.Null -> proto.`null` = true
|
||||||
IrConstKind.Boolean -> proto.boolean = value.value as Boolean
|
IrConstKind.Boolean -> proto.boolean = value.value as Boolean
|
||||||
IrConstKind.Byte -> proto.byte = (value.value as Byte).toInt()
|
IrConstKind.Byte -> proto.byte = (value.value as Byte).toInt()
|
||||||
IrConstKind.Char -> proto.char = (value.value as Char).toInt()
|
IrConstKind.Char -> proto.char = (value.value as Char).code
|
||||||
IrConstKind.Short -> proto.short = (value.value as Short).toInt()
|
IrConstKind.Short -> proto.short = (value.value as Short).toInt()
|
||||||
IrConstKind.Int -> proto.int = value.value as Int
|
IrConstKind.Int -> proto.int = value.value as Int
|
||||||
IrConstKind.Long -> proto.long = value.value as Long
|
IrConstKind.Long -> proto.long = value.value as Long
|
||||||
|
|||||||
+1
-1
@@ -73,7 +73,7 @@ open class AnnotationSerializer(private val stringTable: DescriptorAwareStringTa
|
|||||||
|
|
||||||
override fun visitCharValue(value: CharValue, data: Unit) {
|
override fun visitCharValue(value: CharValue, data: Unit) {
|
||||||
type = Type.CHAR
|
type = Type.CHAR
|
||||||
intValue = value.value.toLong()
|
intValue = value.value.code.toLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitDoubleValue(value: DoubleValue, data: Unit) {
|
override fun visitDoubleValue(value: DoubleValue, data: Unit) {
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class JvmNameResolverTest : KtUsefulTestCase() {
|
|||||||
internalString?.let { setString(it) }
|
internalString?.let { setString(it) }
|
||||||
operation?.let { setOperation(it) }
|
operation?.let { setOperation(it) }
|
||||||
substringIndex?.let { addAllSubstringIndex(it) }
|
substringIndex?.let { addAllSubstringIndex(it) }
|
||||||
replaceChar?.let { addAllReplaceChar(it.map(Char::toInt)) }
|
replaceChar?.let { addAllReplaceChar(it.map(Char::code)) }
|
||||||
}.build())
|
}.build())
|
||||||
|
|
||||||
string?.let { strings.add(it) }
|
string?.let { strings.add(it) }
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class CharValue(value: Char) : IntegerValueConstant<Char>(value) {
|
|||||||
|
|
||||||
override fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D) = visitor.visitCharValue(this, data)
|
override fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D) = visitor.visitCharValue(this, data)
|
||||||
|
|
||||||
override fun toString() = "\\u%04X ('%s')".format(value.toInt(), getPrintablePart(value))
|
override fun toString() = "\\u%04X ('%s')".format(value.code, getPrintablePart(value))
|
||||||
|
|
||||||
private fun getPrintablePart(c: Char): String = when (c) {
|
private fun getPrintablePart(c: Char): String = when (c) {
|
||||||
'\b' -> "\\b"
|
'\b' -> "\\b"
|
||||||
|
|||||||
+1
-1
@@ -73,7 +73,7 @@ class AnnotationDeserializer(private val module: ModuleDescriptor, private val n
|
|||||||
|
|
||||||
return when (value.type) {
|
return when (value.type) {
|
||||||
Type.BYTE -> value.intValue.toByte().letIf(isUnsigned, ::UByteValue, ::ByteValue)
|
Type.BYTE -> value.intValue.toByte().letIf(isUnsigned, ::UByteValue, ::ByteValue)
|
||||||
Type.CHAR -> CharValue(value.intValue.toChar())
|
Type.CHAR -> CharValue(value.intValue.toInt().toChar())
|
||||||
Type.SHORT -> value.intValue.toShort().letIf(isUnsigned, ::UShortValue, ::ShortValue)
|
Type.SHORT -> value.intValue.toShort().letIf(isUnsigned, ::UShortValue, ::ShortValue)
|
||||||
Type.INT -> value.intValue.toInt().letIf(isUnsigned, ::UIntValue, ::IntValue)
|
Type.INT -> value.intValue.toInt().letIf(isUnsigned, ::UIntValue, ::IntValue)
|
||||||
Type.LONG -> value.intValue.letIf(isUnsigned, ::ULongValue, ::LongValue)
|
Type.LONG -> value.intValue.letIf(isUnsigned, ::ULongValue, ::LongValue)
|
||||||
|
|||||||
+1
-1
@@ -62,7 +62,7 @@ fun stringsToBytes(strings: Array<String>): ByteArray {
|
|||||||
var i = 0
|
var i = 0
|
||||||
for (s in strings) {
|
for (s in strings) {
|
||||||
for (si in 0..s.length - 1) {
|
for (si in 0..s.length - 1) {
|
||||||
result[i++] = s[si].toByte()
|
result[i++] = s[si].code.toByte()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ fun generateMap(): String {
|
|||||||
|
|
||||||
val binaryIrOperationsMap = getBinaryIrOperationMap(irBuiltIns)
|
val binaryIrOperationsMap = getBinaryIrOperationMap(irBuiltIns)
|
||||||
|
|
||||||
p.println("@Suppress(\"DEPRECATION_ERROR\")")
|
p.println("@Suppress(\"DEPRECATION\", \"DEPRECATION_ERROR\")")
|
||||||
p.println("val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(")
|
p.println("val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(")
|
||||||
p.println(generateUnaryBody(unaryOperationsMap, irBuiltIns))
|
p.println(generateUnaryBody(unaryOperationsMap, irBuiltIns))
|
||||||
p.println(")")
|
p.println(")")
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ class InlayScratchFileRenderer(val text: String, private val outputType: Scratch
|
|||||||
val attributes = getAttributesForOutputType(outputType)
|
val attributes = getAttributesForOutputType(outputType)
|
||||||
val fontStyle = attributes.fontType
|
val fontStyle = attributes.fontType
|
||||||
return ComplementaryFontsRegistry.getFontAbleToDisplay(
|
return ComplementaryFontsRegistry.getFontAbleToDisplay(
|
||||||
'a'.toInt(), fontStyle, fontPreferences, FontInfo.getFontRenderContext(editor.contentComponent)
|
'a'.code, fontStyle, fontPreferences, FontInfo.getFontRenderContext(editor.contentComponent)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class LabelValue(value: LabelNode) : AbstractValue<LabelNode>(value, Type.VOID_T
|
|||||||
fun boolean(v: Boolean) = IntValue(if (v) 1 else 0, Type.BOOLEAN_TYPE)
|
fun boolean(v: Boolean) = IntValue(if (v) 1 else 0, Type.BOOLEAN_TYPE)
|
||||||
fun byte(v: Byte) = IntValue(v.toInt(), Type.BYTE_TYPE)
|
fun byte(v: Byte) = IntValue(v.toInt(), Type.BYTE_TYPE)
|
||||||
fun short(v: Short) = IntValue(v.toInt(), Type.SHORT_TYPE)
|
fun short(v: Short) = IntValue(v.toInt(), Type.SHORT_TYPE)
|
||||||
fun char(v: Char) = IntValue(v.toInt(), Type.CHAR_TYPE)
|
fun char(v: Char) = IntValue(v.code, Type.CHAR_TYPE)
|
||||||
fun int(v: Int) = IntValue(v, Type.INT_TYPE)
|
fun int(v: Int) = IntValue(v, Type.INT_TYPE)
|
||||||
fun long(v: Long) = LongValue(v)
|
fun long(v: Long) = LongValue(v)
|
||||||
fun float(v: Float) = FloatValue(v)
|
fun float(v: Float) = FloatValue(v)
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ private fun String.offsetOf(position: CodePosition): Int {
|
|||||||
i++
|
i++
|
||||||
offsetInLine++
|
offsetInLine++
|
||||||
|
|
||||||
if (isEndOfLine(c.toInt())) {
|
if (isEndOfLine(c.code)) {
|
||||||
offsetInLine = 0
|
offsetInLine = 0
|
||||||
lineCount++
|
lineCount++
|
||||||
assert(lineCount <= position.line)
|
assert(lineCount <= position.line)
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ fun String.underlineAsText(from: Int, to: Int): String {
|
|||||||
marks.append(mark)
|
marks.append(mark)
|
||||||
lineWasMarked = lineWasMarked || mark != ' '
|
lineWasMarked = lineWasMarked || mark != ' '
|
||||||
|
|
||||||
if (isEndOfLine(c.toInt())) {
|
if (isEndOfLine(c.code)) {
|
||||||
if (lineWasMarked) {
|
if (lineWasMarked) {
|
||||||
lines.appendLine(marks.toString().trimEnd())
|
lines.appendLine(marks.toString().trimEnd())
|
||||||
lineWasMarked = false
|
lineWasMarked = false
|
||||||
@@ -121,7 +121,7 @@ fun String.underlineAsHtml(from: Int, to: Int): String {
|
|||||||
|
|
||||||
lines.append(mark)
|
lines.append(mark)
|
||||||
|
|
||||||
if (isEndOfLine(c.toInt()) && openMarker) {
|
if (isEndOfLine(c.code) && openMarker) {
|
||||||
lines.append(underlineEnd + c + underlineStart)
|
lines.append(underlineEnd + c + underlineStart)
|
||||||
} else {
|
} else {
|
||||||
lines.append(c)
|
lines.append(c)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
@file:Suppress("DEPRECATION") // TODO: needs an intensive rework for new Char API
|
||||||
package org.jetbrains.kotlin.js.parser.sourcemaps
|
package org.jetbrains.kotlin.js.parser.sourcemaps
|
||||||
|
|
||||||
import java.io.*
|
import java.io.*
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@file:Suppress("DEPRECATION") // TODO: needs an intensive rework for new Char API
|
||||||
package org.jetbrains.kotlin.js.parser.sourcemaps
|
package org.jetbrains.kotlin.js.parser.sourcemaps
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ private constructor(private val whenExpression: KtWhenExpression, context: Trans
|
|||||||
is Int -> JsIntLiteral(it)
|
is Int -> JsIntLiteral(it)
|
||||||
is Short -> JsIntLiteral(it.toInt())
|
is Short -> JsIntLiteral(it.toInt())
|
||||||
is Byte -> JsIntLiteral(it.toInt())
|
is Byte -> JsIntLiteral(it.toInt())
|
||||||
is Char -> JsIntLiteral(it.toInt())
|
is Char -> JsIntLiteral(it.code)
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1330,7 +1330,7 @@ class ClassFileToSourceStubConverter(val kaptContext: KaptContextForStubGenerati
|
|||||||
private fun convertValueOfPrimitiveTypeOrString(value: Any?): JCExpression? {
|
private fun convertValueOfPrimitiveTypeOrString(value: Any?): JCExpression? {
|
||||||
fun specialFpValueNumerator(value: Double): Double = if (value.isNaN()) 0.0 else 1.0 * value.sign
|
fun specialFpValueNumerator(value: Double): Double = if (value.isNaN()) 0.0 else 1.0 * value.sign
|
||||||
return when (value) {
|
return when (value) {
|
||||||
is Char -> treeMaker.Literal(TypeTag.CHAR, value.toInt())
|
is Char -> treeMaker.Literal(TypeTag.CHAR, value.code)
|
||||||
is Byte -> treeMaker.TypeCast(treeMaker.TypeIdent(TypeTag.BYTE), treeMaker.Literal(TypeTag.INT, value.toInt()))
|
is Byte -> treeMaker.TypeCast(treeMaker.TypeIdent(TypeTag.BYTE), treeMaker.Literal(TypeTag.INT, value.toInt()))
|
||||||
is Short -> treeMaker.TypeCast(treeMaker.TypeIdent(TypeTag.SHORT), treeMaker.Literal(TypeTag.INT, value.toInt()))
|
is Short -> treeMaker.TypeCast(treeMaker.TypeIdent(TypeTag.SHORT), treeMaker.Literal(TypeTag.INT, value.toInt()))
|
||||||
is Boolean, is Int, is Long, is String -> treeMaker.Literal(value)
|
is Boolean, is Int, is Long, is String -> treeMaker.Literal(value)
|
||||||
|
|||||||
Reference in New Issue
Block a user