JS: use string table for module names and inline function tags

This commit is contained in:
Anton Bannykh
2019-02-01 15:13:26 +03:00
parent d7499363bc
commit a35fc4fa3c
5 changed files with 108 additions and 424 deletions
@@ -831,18 +831,13 @@ public final class DebugJsAstProtoBuf {
org.jetbrains.kotlin.protobuf.MessageOrBuilder { org.jetbrains.kotlin.protobuf.MessageOrBuilder {
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
boolean hasExternalName(); boolean hasExternalName();
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
java.lang.String getExternalName(); int getExternalName();
/**
* <code>required string external_name = 1;</code>
*/
org.jetbrains.kotlin.protobuf.ByteString
getExternalNameBytes();
/** /**
* <code>required int32 internal_name = 2;</code> * <code>required int32 internal_name = 2;</code>
@@ -918,10 +913,9 @@ public final class DebugJsAstProtoBuf {
} }
break; break;
} }
case 10: { case 8: {
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
externalName_ = bs; externalName_ = input.readInt32();
break; break;
} }
case 16: { case 16: {
@@ -983,45 +977,18 @@ public final class DebugJsAstProtoBuf {
private int bitField0_; private int bitField0_;
public static final int EXTERNAL_NAME_FIELD_NUMBER = 1; public static final int EXTERNAL_NAME_FIELD_NUMBER = 1;
private java.lang.Object externalName_; private int externalName_;
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public boolean hasExternalName() { public boolean hasExternalName() {
return ((bitField0_ & 0x00000001) == 0x00000001); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public java.lang.String getExternalName() { public int getExternalName() {
java.lang.Object ref = externalName_; return externalName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
externalName_ = s;
}
return s;
}
}
/**
* <code>required string external_name = 1;</code>
*/
public org.jetbrains.kotlin.protobuf.ByteString
getExternalNameBytes() {
java.lang.Object ref = externalName_;
if (ref instanceof java.lang.String) {
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
externalName_ = b;
return b;
} else {
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
} }
public static final int INTERNAL_NAME_FIELD_NUMBER = 2; public static final int INTERNAL_NAME_FIELD_NUMBER = 2;
@@ -1061,7 +1028,7 @@ public final class DebugJsAstProtoBuf {
} }
private void initFields() { private void initFields() {
externalName_ = ""; externalName_ = 0;
internalName_ = 0; internalName_ = 0;
plainReference_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Expression.getDefaultInstance(); plainReference_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Expression.getDefaultInstance();
} }
@@ -1093,7 +1060,7 @@ public final class DebugJsAstProtoBuf {
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getExternalNameBytes()); output.writeInt32(1, externalName_);
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, internalName_); output.writeInt32(2, internalName_);
@@ -1112,7 +1079,7 @@ public final class DebugJsAstProtoBuf {
size = 0; size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBytesSize(1, getExternalNameBytes()); .computeInt32Size(1, externalName_);
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -1240,7 +1207,7 @@ public final class DebugJsAstProtoBuf {
public Builder clear() { public Builder clear() {
super.clear(); super.clear();
externalName_ = ""; externalName_ = 0;
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
internalName_ = 0; internalName_ = 0;
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000002);
@@ -1311,9 +1278,7 @@ public final class DebugJsAstProtoBuf {
public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.JsImportedModule other) { public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.JsImportedModule other) {
if (other == org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.JsImportedModule.getDefaultInstance()) return this; if (other == org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.JsImportedModule.getDefaultInstance()) return this;
if (other.hasExternalName()) { if (other.hasExternalName()) {
bitField0_ |= 0x00000001; setExternalName(other.getExternalName());
externalName_ = other.externalName_;
onChanged();
} }
if (other.hasInternalName()) { if (other.hasInternalName()) {
setInternalName(other.getInternalName()); setInternalName(other.getInternalName());
@@ -1362,78 +1327,34 @@ public final class DebugJsAstProtoBuf {
} }
private int bitField0_; private int bitField0_;
private java.lang.Object externalName_ = ""; private int externalName_ ;
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public boolean hasExternalName() { public boolean hasExternalName() {
return ((bitField0_ & 0x00000001) == 0x00000001); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public java.lang.String getExternalName() { public int getExternalName() {
java.lang.Object ref = externalName_; return externalName_;
if (!(ref instanceof java.lang.String)) {
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
externalName_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
} }
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public org.jetbrains.kotlin.protobuf.ByteString public Builder setExternalName(int value) {
getExternalNameBytes() { bitField0_ |= 0x00000001;
java.lang.Object ref = externalName_;
if (ref instanceof String) {
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
externalName_ = b;
return b;
} else {
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
}
/**
* <code>required string external_name = 1;</code>
*/
public Builder setExternalName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
externalName_ = value; externalName_ = value;
onChanged(); onChanged();
return this; return this;
} }
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public Builder clearExternalName() { public Builder clearExternalName() {
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
externalName_ = getDefaultInstance().getExternalName(); externalName_ = 0;
onChanged();
return this;
}
/**
* <code>required string external_name = 1;</code>
*/
public Builder setExternalNameBytes(
org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
externalName_ = value;
onChanged(); onChanged();
return this; return this;
} }
@@ -45140,18 +45061,13 @@ public final class DebugJsAstProtoBuf {
org.jetbrains.kotlin.protobuf.MessageOrBuilder { org.jetbrains.kotlin.protobuf.MessageOrBuilder {
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
boolean hasTag(); boolean hasTag();
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
java.lang.String getTag(); int getTag();
/**
* <code>required string tag = 1;</code>
*/
org.jetbrains.kotlin.protobuf.ByteString
getTagBytes();
/** /**
* <code>required .org.jetbrains.kotlin.serialization.js.ast.GlobalBlock block = 2;</code> * <code>required .org.jetbrains.kotlin.serialization.js.ast.GlobalBlock block = 2;</code>
@@ -45218,10 +45134,9 @@ public final class DebugJsAstProtoBuf {
} }
break; break;
} }
case 10: { case 8: {
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
tag_ = bs; tag_ = input.readInt32();
break; break;
} }
case 18: { case 18: {
@@ -45278,45 +45193,18 @@ public final class DebugJsAstProtoBuf {
private int bitField0_; private int bitField0_;
public static final int TAG_FIELD_NUMBER = 1; public static final int TAG_FIELD_NUMBER = 1;
private java.lang.Object tag_; private int tag_;
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public boolean hasTag() { public boolean hasTag() {
return ((bitField0_ & 0x00000001) == 0x00000001); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public java.lang.String getTag() { public int getTag() {
java.lang.Object ref = tag_; return tag_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
tag_ = s;
}
return s;
}
}
/**
* <code>required string tag = 1;</code>
*/
public org.jetbrains.kotlin.protobuf.ByteString
getTagBytes() {
java.lang.Object ref = tag_;
if (ref instanceof java.lang.String) {
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
tag_ = b;
return b;
} else {
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
} }
public static final int BLOCK_FIELD_NUMBER = 2; public static final int BLOCK_FIELD_NUMBER = 2;
@@ -45341,7 +45229,7 @@ public final class DebugJsAstProtoBuf {
} }
private void initFields() { private void initFields() {
tag_ = ""; tag_ = 0;
block_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.getDefaultInstance(); block_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.getDefaultInstance();
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
@@ -45370,7 +45258,7 @@ public final class DebugJsAstProtoBuf {
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getTagBytes()); output.writeInt32(1, tag_);
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, block_); output.writeMessage(2, block_);
@@ -45386,7 +45274,7 @@ public final class DebugJsAstProtoBuf {
size = 0; size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBytesSize(1, getTagBytes()); .computeInt32Size(1, tag_);
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -45510,7 +45398,7 @@ public final class DebugJsAstProtoBuf {
public Builder clear() { public Builder clear() {
super.clear(); super.clear();
tag_ = ""; tag_ = 0;
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
if (blockBuilder_ == null) { if (blockBuilder_ == null) {
block_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.getDefaultInstance(); block_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.GlobalBlock.getDefaultInstance();
@@ -45575,9 +45463,7 @@ public final class DebugJsAstProtoBuf {
public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.InlinedLocalDeclarations other) { public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.InlinedLocalDeclarations other) {
if (other == org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.InlinedLocalDeclarations.getDefaultInstance()) return this; if (other == org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.InlinedLocalDeclarations.getDefaultInstance()) return this;
if (other.hasTag()) { if (other.hasTag()) {
bitField0_ |= 0x00000001; setTag(other.getTag());
tag_ = other.tag_;
onChanged();
} }
if (other.hasBlock()) { if (other.hasBlock()) {
mergeBlock(other.getBlock()); mergeBlock(other.getBlock());
@@ -45621,78 +45507,34 @@ public final class DebugJsAstProtoBuf {
} }
private int bitField0_; private int bitField0_;
private java.lang.Object tag_ = ""; private int tag_ ;
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public boolean hasTag() { public boolean hasTag() {
return ((bitField0_ & 0x00000001) == 0x00000001); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public java.lang.String getTag() { public int getTag() {
java.lang.Object ref = tag_; return tag_;
if (!(ref instanceof java.lang.String)) {
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
tag_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
} }
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public org.jetbrains.kotlin.protobuf.ByteString public Builder setTag(int value) {
getTagBytes() { bitField0_ |= 0x00000001;
java.lang.Object ref = tag_;
if (ref instanceof String) {
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
tag_ = b;
return b;
} else {
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
}
/**
* <code>required string tag = 1;</code>
*/
public Builder setTag(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
tag_ = value; tag_ = value;
onChanged(); onChanged();
return this; return this;
} }
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public Builder clearTag() { public Builder clearTag() {
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
tag_ = getDefaultInstance().getTag(); tag_ = 0;
onChanged();
return this;
}
/**
* <code>required string tag = 1;</code>
*/
public Builder setTagBytes(
org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
tag_ = value;
onChanged(); onChanged();
return this; return this;
} }
@@ -53199,7 +53041,7 @@ public final class DebugJsAstProtoBuf {
"o\022)org.jetbrains.kotlin.serialization.js" + "o\022)org.jetbrains.kotlin.serialization.js" +
".ast\"0\n\010Location\022\021\n\tstartLine\030\001 \002(\005\022\021\n\ts" + ".ast\"0\n\010Location\022\021\n\tstartLine\030\001 \002(\005\022\021\n\ts" +
"tartChar\030\002 \002(\005\"\220\001\n\020JsImportedModule\022\025\n\re" + "tartChar\030\002 \002(\005\"\220\001\n\020JsImportedModule\022\025\n\re" +
"xternal_name\030\001 \002(\t\022\025\n\rinternal_name\030\002 \002(" + "xternal_name\030\001 \002(\005\022\025\n\rinternal_name\030\002 \002(" +
"\005\022N\n\017plain_reference\030\003 \001(\01325.org.jetbrai" + "\005\022N\n\017plain_reference\030\003 \001(\01325.org.jetbrai" +
"ns.kotlin.serialization.js.ast.Expressio" + "ns.kotlin.serialization.js.ast.Expressio" +
"n\"\203\016\n\nExpression\022\016\n\006fileId\030\001 \001(\005\022E\n\010loca" + "n\"\203\016\n\nExpression\022\016\n\006fileId\030\001 \001(\005\022E\n\010loca" +
@@ -53465,7 +53307,7 @@ public final class DebugJsAstProtoBuf {
"tatement\022g\n\032inlined_local_declarations\030\r" + "tatement\022g\n\032inlined_local_declarations\030\r" +
" \003(\0132C.org.jetbrains.kotlin.serializatio" + " \003(\0132C.org.jetbrains.kotlin.serializatio" +
"n.js.ast.InlinedLocalDeclarations\"n\n\030Inl", "n.js.ast.InlinedLocalDeclarations\"n\n\030Inl",
"inedLocalDeclarations\022\013\n\003tag\030\001 \002(\t\022E\n\005bl" + "inedLocalDeclarations\022\013\n\003tag\030\001 \002(\005\022E\n\005bl" +
"ock\030\002 \002(\01326.org.jetbrains.kotlin.seriali" + "ock\030\002 \002(\01326.org.jetbrains.kotlin.seriali" +
"zation.js.ast.GlobalBlock\"\224\001\n\016ImportedMo" + "zation.js.ast.GlobalBlock\"\224\001\n\016ImportedMo" +
"dule\022\030\n\020external_name_id\030\001 \002(\005\022\030\n\020intern" + "dule\022\030\n\020external_name_id\030\001 \002(\005\022\030\n\020intern" +
+2 -2
View File
@@ -32,7 +32,7 @@ enum SideEffects {
} }
message JsImportedModule { message JsImportedModule {
required string external_name = 1; required int32 external_name = 1;
required int32 internal_name = 2; required int32 internal_name = 2;
optional Expression plain_reference = 3; optional Expression plain_reference = 3;
} }
@@ -398,7 +398,7 @@ message Fragment {
} }
message InlinedLocalDeclarations { message InlinedLocalDeclarations {
required string tag = 1; required int32 tag = 1;
required GlobalBlock block = 2; required GlobalBlock block = 2;
} }
@@ -108,7 +108,7 @@ class JsAstDeserializer(program: JsProgram, private val sourceRoots: Iterable<Fi
} }
proto.inlinedLocalDeclarationsList.forEach { proto.inlinedLocalDeclarationsList.forEach {
fragment.inlinedLocalDeclarations[it.tag] = deserializeGlobalBlock(it.block) fragment.inlinedLocalDeclarations[deserializeString(it.tag)] = deserializeGlobalBlock(it.block)
} }
return fragment return fragment
@@ -292,7 +292,7 @@ class JsAstDeserializer(program: JsProgram, private val sourceRoots: Iterable<Fi
} }
private fun deserializeJsImportedModule(proto: JsAstProtoBuf.JsImportedModule): JsImportedModule { private fun deserializeJsImportedModule(proto: JsAstProtoBuf.JsImportedModule): JsImportedModule {
return JsImportedModule(proto.externalName, deserializeName(proto.internalName), if (proto.hasPlainReference()) deserialize(proto.plainReference!!) else null) return JsImportedModule(deserializeString(proto.externalName), deserializeName(proto.internalName), if (proto.hasPlainReference()) deserialize(proto.plainReference!!) else null)
} }
private fun deserializeNoMetadata(proto: Expression): JsExpression = when (proto.expressionCase) { private fun deserializeNoMetadata(proto: Expression): JsExpression = when (proto.expressionCase) {
@@ -708,18 +708,13 @@ public final class JsAstProtoBuf {
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder { org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
boolean hasExternalName(); boolean hasExternalName();
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
java.lang.String getExternalName(); int getExternalName();
/**
* <code>required string external_name = 1;</code>
*/
org.jetbrains.kotlin.protobuf.ByteString
getExternalNameBytes();
/** /**
* <code>required int32 internal_name = 2;</code> * <code>required int32 internal_name = 2;</code>
@@ -789,10 +784,9 @@ public final class JsAstProtoBuf {
} }
break; break;
} }
case 10: { case 8: {
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
externalName_ = bs; externalName_ = input.readInt32();
break; break;
} }
case 16: { case 16: {
@@ -848,45 +842,18 @@ public final class JsAstProtoBuf {
private int bitField0_; private int bitField0_;
public static final int EXTERNAL_NAME_FIELD_NUMBER = 1; public static final int EXTERNAL_NAME_FIELD_NUMBER = 1;
private java.lang.Object externalName_; private int externalName_;
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public boolean hasExternalName() { public boolean hasExternalName() {
return ((bitField0_ & 0x00000001) == 0x00000001); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public java.lang.String getExternalName() { public int getExternalName() {
java.lang.Object ref = externalName_; return externalName_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
externalName_ = s;
}
return s;
}
}
/**
* <code>required string external_name = 1;</code>
*/
public org.jetbrains.kotlin.protobuf.ByteString
getExternalNameBytes() {
java.lang.Object ref = externalName_;
if (ref instanceof java.lang.String) {
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
externalName_ = b;
return b;
} else {
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
} }
public static final int INTERNAL_NAME_FIELD_NUMBER = 2; public static final int INTERNAL_NAME_FIELD_NUMBER = 2;
@@ -920,7 +887,7 @@ public final class JsAstProtoBuf {
} }
private void initFields() { private void initFields() {
externalName_ = ""; externalName_ = 0;
internalName_ = 0; internalName_ = 0;
plainReference_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Expression.getDefaultInstance(); plainReference_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Expression.getDefaultInstance();
} }
@@ -952,7 +919,7 @@ public final class JsAstProtoBuf {
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getExternalNameBytes()); output.writeInt32(1, externalName_);
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeInt32(2, internalName_); output.writeInt32(2, internalName_);
@@ -971,7 +938,7 @@ public final class JsAstProtoBuf {
size = 0; size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBytesSize(1, getExternalNameBytes()); .computeInt32Size(1, externalName_);
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -1075,7 +1042,7 @@ public final class JsAstProtoBuf {
public Builder clear() { public Builder clear() {
super.clear(); super.clear();
externalName_ = ""; externalName_ = 0;
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
internalName_ = 0; internalName_ = 0;
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000002);
@@ -1123,9 +1090,7 @@ public final class JsAstProtoBuf {
public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.JsImportedModule other) { public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.JsImportedModule other) {
if (other == org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.JsImportedModule.getDefaultInstance()) return this; if (other == org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.JsImportedModule.getDefaultInstance()) return this;
if (other.hasExternalName()) { if (other.hasExternalName()) {
bitField0_ |= 0x00000001; setExternalName(other.getExternalName());
externalName_ = other.externalName_;
} }
if (other.hasInternalName()) { if (other.hasInternalName()) {
setInternalName(other.getInternalName()); setInternalName(other.getInternalName());
@@ -1175,78 +1140,34 @@ public final class JsAstProtoBuf {
} }
private int bitField0_; private int bitField0_;
private java.lang.Object externalName_ = ""; private int externalName_ ;
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public boolean hasExternalName() { public boolean hasExternalName() {
return ((bitField0_ & 0x00000001) == 0x00000001); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public java.lang.String getExternalName() { public int getExternalName() {
java.lang.Object ref = externalName_; return externalName_;
if (!(ref instanceof java.lang.String)) {
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
externalName_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
} }
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public org.jetbrains.kotlin.protobuf.ByteString public Builder setExternalName(int value) {
getExternalNameBytes() { bitField0_ |= 0x00000001;
java.lang.Object ref = externalName_;
if (ref instanceof String) {
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
externalName_ = b;
return b;
} else {
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
}
/**
* <code>required string external_name = 1;</code>
*/
public Builder setExternalName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
externalName_ = value; externalName_ = value;
return this; return this;
} }
/** /**
* <code>required string external_name = 1;</code> * <code>required int32 external_name = 1;</code>
*/ */
public Builder clearExternalName() { public Builder clearExternalName() {
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
externalName_ = getDefaultInstance().getExternalName(); externalName_ = 0;
return this;
}
/**
* <code>required string external_name = 1;</code>
*/
public Builder setExternalNameBytes(
org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
externalName_ = value;
return this; return this;
} }
@@ -32926,18 +32847,13 @@ public final class JsAstProtoBuf {
org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder { org.jetbrains.kotlin.protobuf.MessageLiteOrBuilder {
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
boolean hasTag(); boolean hasTag();
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
java.lang.String getTag(); int getTag();
/**
* <code>required string tag = 1;</code>
*/
org.jetbrains.kotlin.protobuf.ByteString
getTagBytes();
/** /**
* <code>required .org.jetbrains.kotlin.serialization.js.ast.GlobalBlock block = 2;</code> * <code>required .org.jetbrains.kotlin.serialization.js.ast.GlobalBlock block = 2;</code>
@@ -32998,10 +32914,9 @@ public final class JsAstProtoBuf {
} }
break; break;
} }
case 10: { case 8: {
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
tag_ = bs; tag_ = input.readInt32();
break; break;
} }
case 18: { case 18: {
@@ -33052,45 +32967,18 @@ public final class JsAstProtoBuf {
private int bitField0_; private int bitField0_;
public static final int TAG_FIELD_NUMBER = 1; public static final int TAG_FIELD_NUMBER = 1;
private java.lang.Object tag_; private int tag_;
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public boolean hasTag() { public boolean hasTag() {
return ((bitField0_ & 0x00000001) == 0x00000001); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public java.lang.String getTag() { public int getTag() {
java.lang.Object ref = tag_; return tag_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
tag_ = s;
}
return s;
}
}
/**
* <code>required string tag = 1;</code>
*/
public org.jetbrains.kotlin.protobuf.ByteString
getTagBytes() {
java.lang.Object ref = tag_;
if (ref instanceof java.lang.String) {
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
tag_ = b;
return b;
} else {
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
} }
public static final int BLOCK_FIELD_NUMBER = 2; public static final int BLOCK_FIELD_NUMBER = 2;
@@ -33109,7 +32997,7 @@ public final class JsAstProtoBuf {
} }
private void initFields() { private void initFields() {
tag_ = ""; tag_ = 0;
block_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.GlobalBlock.getDefaultInstance(); block_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.GlobalBlock.getDefaultInstance();
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
@@ -33138,7 +33026,7 @@ public final class JsAstProtoBuf {
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getTagBytes()); output.writeInt32(1, tag_);
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeMessage(2, block_); output.writeMessage(2, block_);
@@ -33154,7 +33042,7 @@ public final class JsAstProtoBuf {
size = 0; size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBytesSize(1, getTagBytes()); .computeInt32Size(1, tag_);
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += org.jetbrains.kotlin.protobuf.CodedOutputStream size += org.jetbrains.kotlin.protobuf.CodedOutputStream
@@ -33254,7 +33142,7 @@ public final class JsAstProtoBuf {
public Builder clear() { public Builder clear() {
super.clear(); super.clear();
tag_ = ""; tag_ = 0;
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
block_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.GlobalBlock.getDefaultInstance(); block_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.GlobalBlock.getDefaultInstance();
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000002);
@@ -33296,9 +33184,7 @@ public final class JsAstProtoBuf {
public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.InlinedLocalDeclarations other) { public Builder mergeFrom(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.InlinedLocalDeclarations other) {
if (other == org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.InlinedLocalDeclarations.getDefaultInstance()) return this; if (other == org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.InlinedLocalDeclarations.getDefaultInstance()) return this;
if (other.hasTag()) { if (other.hasTag()) {
bitField0_ |= 0x00000001; setTag(other.getTag());
tag_ = other.tag_;
} }
if (other.hasBlock()) { if (other.hasBlock()) {
mergeBlock(other.getBlock()); mergeBlock(other.getBlock());
@@ -33343,78 +33229,34 @@ public final class JsAstProtoBuf {
} }
private int bitField0_; private int bitField0_;
private java.lang.Object tag_ = ""; private int tag_ ;
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public boolean hasTag() { public boolean hasTag() {
return ((bitField0_ & 0x00000001) == 0x00000001); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public java.lang.String getTag() { public int getTag() {
java.lang.Object ref = tag_; return tag_;
if (!(ref instanceof java.lang.String)) {
org.jetbrains.kotlin.protobuf.ByteString bs =
(org.jetbrains.kotlin.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
tag_ = s;
}
return s;
} else {
return (java.lang.String) ref;
}
} }
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public org.jetbrains.kotlin.protobuf.ByteString public Builder setTag(int value) {
getTagBytes() { bitField0_ |= 0x00000001;
java.lang.Object ref = tag_;
if (ref instanceof String) {
org.jetbrains.kotlin.protobuf.ByteString b =
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
tag_ = b;
return b;
} else {
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
}
}
/**
* <code>required string tag = 1;</code>
*/
public Builder setTag(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
tag_ = value; tag_ = value;
return this; return this;
} }
/** /**
* <code>required string tag = 1;</code> * <code>required int32 tag = 1;</code>
*/ */
public Builder clearTag() { public Builder clearTag() {
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
tag_ = getDefaultInstance().getTag(); tag_ = 0;
return this;
}
/**
* <code>required string tag = 1;</code>
*/
public Builder setTagBytes(
org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
tag_ = value;
return this; return this;
} }
@@ -117,7 +117,7 @@ class JsAstSerializer(private val jsAstValidator: ((JsProgramFragment, Set<JsNam
fragment.inlinedLocalDeclarations.forEach { (tag, block) -> fragment.inlinedLocalDeclarations.forEach { (tag, block) ->
val builder = InlinedLocalDeclarations.newBuilder().apply { val builder = InlinedLocalDeclarations.newBuilder().apply {
setTag(tag) setTag(serialize(tag))
setBlock(serializeBlock(block)) setBlock(serializeBlock(block))
} }
@@ -474,7 +474,7 @@ class JsAstSerializer(private val jsAstValidator: ((JsProgramFragment, Set<JsNam
private fun serialize(module: JsImportedModule): JsAstProtoBuf.JsImportedModule { private fun serialize(module: JsImportedModule): JsAstProtoBuf.JsImportedModule {
val moduleBuilder = JsAstProtoBuf.JsImportedModule.newBuilder() val moduleBuilder = JsAstProtoBuf.JsImportedModule.newBuilder()
moduleBuilder.externalName = module.externalName moduleBuilder.externalName = serialize(module.externalName)
moduleBuilder.internalName = serialize(module.internalName) moduleBuilder.internalName = serialize(module.internalName)
module.plainReference?.let { module.plainReference?.let {
moduleBuilder.plainReference = serialize(it) moduleBuilder.plainReference = serialize(it)