[K/JS] serialize enum entries as a byte instead of int

This commit is contained in:
Artem Kobzar
2023-01-12 21:15:01 +00:00
committed by Space Team
parent df778b8a6e
commit 7156200953
2 changed files with 9 additions and 9 deletions
@@ -298,16 +298,16 @@ private class JsIrAstDeserializer(private val source: ByteArray) {
}
BINARY_OPERATION -> {
JsBinaryOperation(
jsBinaryOperatorValues[readInt()],
jsBinaryOperatorValues[readByte().toInt()],
readExpression(),
readExpression()
)
}
PREFIX_OPERATION -> {
JsPrefixOperation(jsUnaryOperatorValues[readInt()], readExpression())
JsPrefixOperation(jsUnaryOperatorValues[readByte().toInt()], readExpression())
}
POSTFIX_OPERATION -> {
JsPostfixOperation(jsUnaryOperatorValues[readInt()], readExpression())
JsPostfixOperation(jsUnaryOperatorValues[readByte().toInt()], readExpression())
}
CONDITIONAL -> {
JsConditional(
@@ -348,7 +348,7 @@ private class JsIrAstDeserializer(private val source: ByteArray) {
}
}.apply {
synthetic = readBoolean()
sideEffects = sideEffectKindValues[readInt()]
sideEffects = sideEffectKindValues[readByte().toInt()]
ifTrue { localAlias = readJsImportedModule() }
}
}
@@ -412,20 +412,20 @@ private class JsIrAstSerializer {
override fun visitBinaryExpression(x: JsBinaryOperation) {
writeByte(ExpressionIds.BINARY_OPERATION)
writeInt(x.operator.ordinal)
writeByte(x.operator.ordinal)
writeExpression(x.arg1)
writeExpression(x.arg2)
}
override fun visitPrefixOperation(x: JsPrefixOperation) {
writeByte(ExpressionIds.PREFIX_OPERATION)
writeInt(x.operator.ordinal)
writeByte(x.operator.ordinal)
writeExpression(x.arg)
}
override fun visitPostfixOperation(x: JsPostfixOperation) {
writeByte(ExpressionIds.POSTFIX_OPERATION)
writeInt(x.operator.ordinal)
writeByte(x.operator.ordinal)
writeExpression(x.arg)
}
@@ -484,7 +484,7 @@ private class JsIrAstSerializer {
}
writeBoolean(expression.synthetic)
writeInt(expression.sideEffects.ordinal)
writeByte(expression.sideEffects.ordinal)
ifNotNull(expression.localAlias) { writeImportedModule(it) }
}
@@ -528,7 +528,7 @@ private class JsIrAstSerializer {
writeBoolean(name.isTemporary)
ifNotNull(name.localAlias) { writeLocalAlias(it) }
writeBoolean(name.imported && name !in importedNames)
ifNotNull(name.specialFunction) { writeInt(it.ordinal) }
ifNotNull(name.specialFunction) { writeByte(it.ordinal) }
}
nameMap.size
}