JVM_IR: save auxTables as byte strings
This commit is contained in:
committed by
TeamCityServer
parent
7dbdb311e1
commit
ab3d6490ed
@@ -55,10 +55,10 @@ message XStatementOrExpression {
|
||||
//}
|
||||
|
||||
message AuxTables {
|
||||
repeated common.serialization.proto.IrType type = 1;
|
||||
repeated common.serialization.proto.IdSignature signature = 2;
|
||||
repeated string string = 3;
|
||||
repeated XStatementOrExpression body = 4;
|
||||
repeated bytes type = 1;
|
||||
repeated bytes signature = 2;
|
||||
repeated bytes string = 3;
|
||||
repeated bytes body = 4;
|
||||
|
||||
// required TypeTable type_table = 2;
|
||||
// required SignatureTable signature_table = 1;
|
||||
|
||||
+5
-11
@@ -13,6 +13,7 @@ import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.util.IrMessageLogger
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.protobuf.ByteString
|
||||
|
||||
class JvmIrSerializer(
|
||||
@@ -47,17 +48,10 @@ class JvmIrSerializer(
|
||||
|
||||
private fun serializeAuxTables(): JvmIr.AuxTables {
|
||||
val proto = JvmIr.AuxTables.newBuilder()
|
||||
proto.addAllType(protoTypeArray)
|
||||
proto.addAllSignature(protoIdSignatureArray)
|
||||
proto.addAllString(protoStringArray)
|
||||
for (body in protoBodyArray) {
|
||||
val bodyProto = JvmIr.XStatementOrExpression.newBuilder()
|
||||
when (body) {
|
||||
is XStatementOrExpression.XStatement -> bodyProto.statement = body.toProtoStatement()
|
||||
is XStatementOrExpression.XExpression -> bodyProto.expression = body.toProtoExpression()
|
||||
}
|
||||
proto.addBody(bodyProto.build())
|
||||
}
|
||||
protoTypeArray.forEach { proto.addType(it.toByteString()) }
|
||||
protoIdSignatureArray.forEach { proto.addSignature(it.toByteString()) }
|
||||
protoStringArray.forEach { proto.addString(ByteString.copyFromUtf8(it)) }
|
||||
protoBodyArray.forEach { proto.addBody(ByteString.copyFrom(it.toByteArray())) }
|
||||
return proto.build()
|
||||
}
|
||||
}
|
||||
+185
-458
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user