JS: incremental translation of tests and main fun invocation
This commit is contained in:
+602
-39
@@ -40342,6 +40342,46 @@ public final class DebugJsAstProtoBuf {
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.InlineModuleOrBuilder getInlineModuleOrBuilder(
|
||||
int index);
|
||||
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
boolean hasPackageFqn();
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
java.lang.String getPackageFqn();
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ByteString
|
||||
getPackageFqnBytes();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
boolean hasTestsInvocation();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement getTestsInvocation();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder getTestsInvocationOrBuilder();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
boolean hasMainInvocation();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement getMainInvocation();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder getMainInvocationOrBuilder();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.js.ast.Fragment}
|
||||
@@ -40482,6 +40522,38 @@ public final class DebugJsAstProtoBuf {
|
||||
inlineModule_.add(input.readMessage(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.InlineModule.PARSER, extensionRegistry));
|
||||
break;
|
||||
}
|
||||
case 82: {
|
||||
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
|
||||
bitField0_ |= 0x00000008;
|
||||
packageFqn_ = bs;
|
||||
break;
|
||||
}
|
||||
case 90: {
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
subBuilder = testsInvocation_.toBuilder();
|
||||
}
|
||||
testsInvocation_ = input.readMessage(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(testsInvocation_);
|
||||
testsInvocation_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
}
|
||||
case 98: {
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
subBuilder = mainInvocation_.toBuilder();
|
||||
}
|
||||
mainInvocation_ = input.readMessage(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(mainInvocation_);
|
||||
mainInvocation_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000020;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
|
||||
@@ -40813,6 +40885,90 @@ public final class DebugJsAstProtoBuf {
|
||||
return inlineModule_.get(index);
|
||||
}
|
||||
|
||||
public static final int PACKAGE_FQN_FIELD_NUMBER = 10;
|
||||
private java.lang.Object packageFqn_;
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public boolean hasPackageFqn() {
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public java.lang.String getPackageFqn() {
|
||||
java.lang.Object ref = packageFqn_;
|
||||
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()) {
|
||||
packageFqn_ = s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
getPackageFqnBytes() {
|
||||
java.lang.Object ref = packageFqn_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
org.jetbrains.kotlin.protobuf.ByteString b =
|
||||
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
packageFqn_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
|
||||
public static final int TESTS_INVOCATION_FIELD_NUMBER = 11;
|
||||
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement testsInvocation_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public boolean hasTestsInvocation() {
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement getTestsInvocation() {
|
||||
return testsInvocation_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder getTestsInvocationOrBuilder() {
|
||||
return testsInvocation_;
|
||||
}
|
||||
|
||||
public static final int MAIN_INVOCATION_FIELD_NUMBER = 12;
|
||||
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement mainInvocation_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public boolean hasMainInvocation() {
|
||||
return ((bitField0_ & 0x00000020) == 0x00000020);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement getMainInvocation() {
|
||||
return mainInvocation_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder getMainInvocationOrBuilder() {
|
||||
return mainInvocation_;
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
importedModule_ = java.util.Collections.emptyList();
|
||||
importEntry_ = java.util.Collections.emptyList();
|
||||
@@ -40823,6 +40979,9 @@ public final class DebugJsAstProtoBuf {
|
||||
classModel_ = java.util.Collections.emptyList();
|
||||
moduleExpression_ = java.util.Collections.emptyList();
|
||||
inlineModule_ = java.util.Collections.emptyList();
|
||||
packageFqn_ = "";
|
||||
testsInvocation_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance();
|
||||
mainInvocation_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance();
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
@@ -40884,6 +41043,18 @@ public final class DebugJsAstProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTestsInvocation()) {
|
||||
if (!getTestsInvocation().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasMainInvocation()) {
|
||||
if (!getMainInvocation().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
@@ -40918,6 +41089,15 @@ public final class DebugJsAstProtoBuf {
|
||||
for (int i = 0; i < inlineModule_.size(); i++) {
|
||||
output.writeMessage(9, inlineModule_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
output.writeBytes(10, getPackageFqnBytes());
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
output.writeMessage(11, testsInvocation_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
output.writeMessage(12, mainInvocation_);
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
@@ -40963,6 +41143,18 @@ public final class DebugJsAstProtoBuf {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(9, inlineModule_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeBytesSize(10, getPackageFqnBytes());
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(11, testsInvocation_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(12, mainInvocation_);
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
@@ -41081,6 +41273,8 @@ public final class DebugJsAstProtoBuf {
|
||||
getClassModelFieldBuilder();
|
||||
getModuleExpressionFieldBuilder();
|
||||
getInlineModuleFieldBuilder();
|
||||
getTestsInvocationFieldBuilder();
|
||||
getMainInvocationFieldBuilder();
|
||||
}
|
||||
}
|
||||
private static Builder create() {
|
||||
@@ -41143,6 +41337,20 @@ public final class DebugJsAstProtoBuf {
|
||||
} else {
|
||||
inlineModuleBuilder_.clear();
|
||||
}
|
||||
packageFqn_ = "";
|
||||
bitField0_ = (bitField0_ & ~0x00000200);
|
||||
if (testsInvocationBuilder_ == null) {
|
||||
testsInvocation_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance();
|
||||
} else {
|
||||
testsInvocationBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00000400);
|
||||
if (mainInvocationBuilder_ == null) {
|
||||
mainInvocation_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance();
|
||||
} else {
|
||||
mainInvocationBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00000800);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -41249,6 +41457,26 @@ public final class DebugJsAstProtoBuf {
|
||||
} else {
|
||||
result.inlineModule_ = inlineModuleBuilder_.build();
|
||||
}
|
||||
if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
|
||||
to_bitField0_ |= 0x00000008;
|
||||
}
|
||||
result.packageFqn_ = packageFqn_;
|
||||
if (((from_bitField0_ & 0x00000400) == 0x00000400)) {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
}
|
||||
if (testsInvocationBuilder_ == null) {
|
||||
result.testsInvocation_ = testsInvocation_;
|
||||
} else {
|
||||
result.testsInvocation_ = testsInvocationBuilder_.build();
|
||||
}
|
||||
if (((from_bitField0_ & 0x00000800) == 0x00000800)) {
|
||||
to_bitField0_ |= 0x00000020;
|
||||
}
|
||||
if (mainInvocationBuilder_ == null) {
|
||||
result.mainInvocation_ = mainInvocation_;
|
||||
} else {
|
||||
result.mainInvocation_ = mainInvocationBuilder_.build();
|
||||
}
|
||||
result.bitField0_ = to_bitField0_;
|
||||
onBuilt();
|
||||
return result;
|
||||
@@ -41430,6 +41658,17 @@ public final class DebugJsAstProtoBuf {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (other.hasPackageFqn()) {
|
||||
bitField0_ |= 0x00000200;
|
||||
packageFqn_ = other.packageFqn_;
|
||||
onChanged();
|
||||
}
|
||||
if (other.hasTestsInvocation()) {
|
||||
mergeTestsInvocation(other.getTestsInvocation());
|
||||
}
|
||||
if (other.hasMainInvocation()) {
|
||||
mergeMainInvocation(other.getMainInvocation());
|
||||
}
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
return this;
|
||||
}
|
||||
@@ -41489,6 +41728,18 @@ public final class DebugJsAstProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTestsInvocation()) {
|
||||
if (!getTestsInvocation().isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasMainInvocation()) {
|
||||
if (!getMainInvocation().isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -43299,6 +43550,314 @@ public final class DebugJsAstProtoBuf {
|
||||
return inlineModuleBuilder_;
|
||||
}
|
||||
|
||||
private java.lang.Object packageFqn_ = "";
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public boolean hasPackageFqn() {
|
||||
return ((bitField0_ & 0x00000200) == 0x00000200);
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public java.lang.String getPackageFqn() {
|
||||
java.lang.Object ref = packageFqn_;
|
||||
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()) {
|
||||
packageFqn_ = s;
|
||||
}
|
||||
return s;
|
||||
} else {
|
||||
return (java.lang.String) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
getPackageFqnBytes() {
|
||||
java.lang.Object ref = packageFqn_;
|
||||
if (ref instanceof String) {
|
||||
org.jetbrains.kotlin.protobuf.ByteString b =
|
||||
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
packageFqn_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public Builder setPackageFqn(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
bitField0_ |= 0x00000200;
|
||||
packageFqn_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public Builder clearPackageFqn() {
|
||||
bitField0_ = (bitField0_ & ~0x00000200);
|
||||
packageFqn_ = getDefaultInstance().getPackageFqn();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public Builder setPackageFqnBytes(
|
||||
org.jetbrains.kotlin.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
bitField0_ |= 0x00000200;
|
||||
packageFqn_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement testsInvocation_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance();
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder> testsInvocationBuilder_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public boolean hasTestsInvocation() {
|
||||
return ((bitField0_ & 0x00000400) == 0x00000400);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement getTestsInvocation() {
|
||||
if (testsInvocationBuilder_ == null) {
|
||||
return testsInvocation_;
|
||||
} else {
|
||||
return testsInvocationBuilder_.getMessage();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public Builder setTestsInvocation(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement value) {
|
||||
if (testsInvocationBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
testsInvocation_ = value;
|
||||
onChanged();
|
||||
} else {
|
||||
testsInvocationBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00000400;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public Builder setTestsInvocation(
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder builderForValue) {
|
||||
if (testsInvocationBuilder_ == null) {
|
||||
testsInvocation_ = builderForValue.build();
|
||||
onChanged();
|
||||
} else {
|
||||
testsInvocationBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00000400;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public Builder mergeTestsInvocation(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement value) {
|
||||
if (testsInvocationBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00000400) == 0x00000400) &&
|
||||
testsInvocation_ != org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance()) {
|
||||
testsInvocation_ =
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.newBuilder(testsInvocation_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
testsInvocation_ = value;
|
||||
}
|
||||
onChanged();
|
||||
} else {
|
||||
testsInvocationBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00000400;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public Builder clearTestsInvocation() {
|
||||
if (testsInvocationBuilder_ == null) {
|
||||
testsInvocation_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance();
|
||||
onChanged();
|
||||
} else {
|
||||
testsInvocationBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00000400);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder getTestsInvocationBuilder() {
|
||||
bitField0_ |= 0x00000400;
|
||||
onChanged();
|
||||
return getTestsInvocationFieldBuilder().getBuilder();
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder getTestsInvocationOrBuilder() {
|
||||
if (testsInvocationBuilder_ != null) {
|
||||
return testsInvocationBuilder_.getMessageOrBuilder();
|
||||
} else {
|
||||
return testsInvocation_;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder>
|
||||
getTestsInvocationFieldBuilder() {
|
||||
if (testsInvocationBuilder_ == null) {
|
||||
testsInvocationBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder>(
|
||||
getTestsInvocation(),
|
||||
getParentForChildren(),
|
||||
isClean());
|
||||
testsInvocation_ = null;
|
||||
}
|
||||
return testsInvocationBuilder_;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement mainInvocation_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance();
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder> mainInvocationBuilder_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public boolean hasMainInvocation() {
|
||||
return ((bitField0_ & 0x00000800) == 0x00000800);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement getMainInvocation() {
|
||||
if (mainInvocationBuilder_ == null) {
|
||||
return mainInvocation_;
|
||||
} else {
|
||||
return mainInvocationBuilder_.getMessage();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public Builder setMainInvocation(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement value) {
|
||||
if (mainInvocationBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
mainInvocation_ = value;
|
||||
onChanged();
|
||||
} else {
|
||||
mainInvocationBuilder_.setMessage(value);
|
||||
}
|
||||
bitField0_ |= 0x00000800;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public Builder setMainInvocation(
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder builderForValue) {
|
||||
if (mainInvocationBuilder_ == null) {
|
||||
mainInvocation_ = builderForValue.build();
|
||||
onChanged();
|
||||
} else {
|
||||
mainInvocationBuilder_.setMessage(builderForValue.build());
|
||||
}
|
||||
bitField0_ |= 0x00000800;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public Builder mergeMainInvocation(org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement value) {
|
||||
if (mainInvocationBuilder_ == null) {
|
||||
if (((bitField0_ & 0x00000800) == 0x00000800) &&
|
||||
mainInvocation_ != org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance()) {
|
||||
mainInvocation_ =
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.newBuilder(mainInvocation_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
mainInvocation_ = value;
|
||||
}
|
||||
onChanged();
|
||||
} else {
|
||||
mainInvocationBuilder_.mergeFrom(value);
|
||||
}
|
||||
bitField0_ |= 0x00000800;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public Builder clearMainInvocation() {
|
||||
if (mainInvocationBuilder_ == null) {
|
||||
mainInvocation_ = org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.getDefaultInstance();
|
||||
onChanged();
|
||||
} else {
|
||||
mainInvocationBuilder_.clear();
|
||||
}
|
||||
bitField0_ = (bitField0_ & ~0x00000800);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder getMainInvocationBuilder() {
|
||||
bitField0_ |= 0x00000800;
|
||||
onChanged();
|
||||
return getMainInvocationFieldBuilder().getBuilder();
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder getMainInvocationOrBuilder() {
|
||||
if (mainInvocationBuilder_ != null) {
|
||||
return mainInvocationBuilder_.getMessageOrBuilder();
|
||||
} else {
|
||||
return mainInvocation_;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
private org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder>
|
||||
getMainInvocationFieldBuilder() {
|
||||
if (mainInvocationBuilder_ == null) {
|
||||
mainInvocationBuilder_ = new org.jetbrains.kotlin.protobuf.SingleFieldBuilder<
|
||||
org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.Statement.Builder, org.jetbrains.kotlin.serialization.js.ast.DebugJsAstProtoBuf.StatementOrBuilder>(
|
||||
getMainInvocation(),
|
||||
getParentForChildren(),
|
||||
isClean());
|
||||
mainInvocation_ = null;
|
||||
}
|
||||
return mainInvocationBuilder_;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.js.ast.Fragment)
|
||||
}
|
||||
|
||||
@@ -49795,7 +50354,7 @@ public final class DebugJsAstProtoBuf {
|
||||
"4.org.jetbrains.kotlin.serialization.js." +
|
||||
"ast.Parameter\022B\n\004body\030\002 \002(\01324.org.jetbra" +
|
||||
"ins.kotlin.serialization.js.ast.Statemen" +
|
||||
"t\"\007\n\005Empty\"\327\005\n\010Fragment\022R\n\017imported_modu",
|
||||
"t\"\007\n\005Empty\"\213\007\n\010Fragment\022R\n\017imported_modu",
|
||||
"le\030\001 \003(\01329.org.jetbrains.kotlin.serializ" +
|
||||
"ation.js.ast.ImportedModule\022G\n\014import_en" +
|
||||
"try\030\002 \003(\01321.org.jetbrains.kotlin.seriali" +
|
||||
@@ -49813,43 +50372,47 @@ public final class DebugJsAstProtoBuf {
|
||||
"\010 \003(\01325.org.jetbrains.kotlin.serializati" +
|
||||
"on.js.ast.Expression\022N\n\rinline_module\030\t " +
|
||||
"\003(\01327.org.jetbrains.kotlin.serialization" +
|
||||
".js.ast.InlineModule\"\224\001\n\016ImportedModule\022" +
|
||||
"\030\n\020external_name_id\030\001 \002(\005\022\030\n\020internal_na" +
|
||||
"me_id\030\002 \002(\005\022N\n\017plain_reference\030\003 \001(\01325.o",
|
||||
"rg.jetbrains.kotlin.serialization.js.ast" +
|
||||
".Expression\"i\n\006Import\022\024\n\014signature_id\030\001 " +
|
||||
"\002(\005\022I\n\nexpression\030\002 \002(\01325.org.jetbrains." +
|
||||
"kotlin.serialization.js.ast.Expression\"3" +
|
||||
"\n\013NameBinding\022\024\n\014signature_id\030\001 \002(\005\022\016\n\006n" +
|
||||
"ameId\030\002 \002(\005\"\247\001\n\nClassModel\022\017\n\007name_id\030\001 " +
|
||||
"\002(\005\022\025\n\rsuper_name_id\030\002 \001(\005\022\031\n\021interface_" +
|
||||
"name_id\030\004 \003(\005\022V\n\026post_declaration_block\030" +
|
||||
"\003 \001(\01326.org.jetbrains.kotlin.serializati" +
|
||||
"on.js.ast.GlobalBlock\";\n\014InlineModule\022\024\n",
|
||||
"\014signature_id\030\001 \002(\005\022\025\n\rexpression_id\030\002 \002" +
|
||||
"(\005\"\034\n\013StringTable\022\r\n\005entry\030\001 \003(\t\"K\n\tName" +
|
||||
"Table\022>\n\005entry\030\001 \003(\0132/.org.jetbrains.kot" +
|
||||
"lin.serialization.js.ast.Name\"\263\001\n\004Name\022\021" +
|
||||
"\n\ttemporary\030\001 \002(\010\022\022\n\nidentifier\030\002 \001(\005\022\025\n" +
|
||||
"\rlocal_name_id\030\003 \001(\005\022\027\n\010imported\030\004 \001(\010:\005" +
|
||||
"false\022T\n\020special_function\030\005 \001(\0162:.org.je" +
|
||||
"tbrains.kotlin.serialization.js.ast.Spec" +
|
||||
"ialFunction\"\346\001\n\005Chunk\022L\n\014string_table\030\001 " +
|
||||
"\002(\01326.org.jetbrains.kotlin.serialization",
|
||||
".js.ast.StringTable\022H\n\nname_table\030\002 \002(\0132" +
|
||||
"4.org.jetbrains.kotlin.serialization.js." +
|
||||
"ast.NameTable\022E\n\010fragment\030\003 \002(\01323.org.je" +
|
||||
"tbrains.kotlin.serialization.js.ast.Frag" +
|
||||
"ment*@\n\013SideEffects\022\021\n\rAFFECTS_STATE\020\001\022\024" +
|
||||
"\n\020DEPENDS_ON_STATE\020\002\022\010\n\004PURE\020\003*?\n\016Inline" +
|
||||
"Strategy\022\017\n\013AS_FUNCTION\020\000\022\014\n\010IN_PLACE\020\001\022" +
|
||||
"\016\n\nNOT_INLINE\020\002*\327\001\n\017SpecialFunction\022\032\n\026D" +
|
||||
"EFINE_INLINE_FUNCTION\020\001\022\021\n\rWRAP_FUNCTION" +
|
||||
"\020\002\022\021\n\rTO_BOXED_CHAR\020\003\022\016\n\nUNBOX_CHAR\020\004\022\020\n",
|
||||
"\014SUSPEND_CALL\020\005\022\024\n\020COROUTINE_RESULT\020\006\022\030\n" +
|
||||
"\024COROUTINE_CONTROLLER\020\007\022\026\n\022COROUTINE_REC" +
|
||||
"EIVER\020\010\022\030\n\024SET_COROUTINE_RESULT\020\tB\024B\022Deb" +
|
||||
"ugJsAstProtoBuf"
|
||||
".js.ast.InlineModule\022\023\n\013package_fqn\030\n \001(" +
|
||||
"\t\022N\n\020tests_invocation\030\013 \001(\01324.org.jetbra" +
|
||||
"ins.kotlin.serialization.js.ast.Statemen",
|
||||
"t\022M\n\017main_invocation\030\014 \001(\01324.org.jetbrai" +
|
||||
"ns.kotlin.serialization.js.ast.Statement" +
|
||||
"\"\224\001\n\016ImportedModule\022\030\n\020external_name_id\030" +
|
||||
"\001 \002(\005\022\030\n\020internal_name_id\030\002 \002(\005\022N\n\017plain" +
|
||||
"_reference\030\003 \001(\01325.org.jetbrains.kotlin." +
|
||||
"serialization.js.ast.Expression\"i\n\006Impor" +
|
||||
"t\022\024\n\014signature_id\030\001 \002(\005\022I\n\nexpression\030\002 " +
|
||||
"\002(\01325.org.jetbrains.kotlin.serialization" +
|
||||
".js.ast.Expression\"3\n\013NameBinding\022\024\n\014sig" +
|
||||
"nature_id\030\001 \002(\005\022\016\n\006nameId\030\002 \002(\005\"\247\001\n\nClas",
|
||||
"sModel\022\017\n\007name_id\030\001 \002(\005\022\025\n\rsuper_name_id" +
|
||||
"\030\002 \001(\005\022\031\n\021interface_name_id\030\004 \003(\005\022V\n\026pos" +
|
||||
"t_declaration_block\030\003 \001(\01326.org.jetbrain" +
|
||||
"s.kotlin.serialization.js.ast.GlobalBloc" +
|
||||
"k\";\n\014InlineModule\022\024\n\014signature_id\030\001 \002(\005\022" +
|
||||
"\025\n\rexpression_id\030\002 \002(\005\"\034\n\013StringTable\022\r\n" +
|
||||
"\005entry\030\001 \003(\t\"K\n\tNameTable\022>\n\005entry\030\001 \003(\013" +
|
||||
"2/.org.jetbrains.kotlin.serialization.js" +
|
||||
".ast.Name\"\263\001\n\004Name\022\021\n\ttemporary\030\001 \002(\010\022\022\n" +
|
||||
"\nidentifier\030\002 \001(\005\022\025\n\rlocal_name_id\030\003 \001(\005",
|
||||
"\022\027\n\010imported\030\004 \001(\010:\005false\022T\n\020special_fun" +
|
||||
"ction\030\005 \001(\0162:.org.jetbrains.kotlin.seria" +
|
||||
"lization.js.ast.SpecialFunction\"\346\001\n\005Chun" +
|
||||
"k\022L\n\014string_table\030\001 \002(\01326.org.jetbrains." +
|
||||
"kotlin.serialization.js.ast.StringTable\022" +
|
||||
"H\n\nname_table\030\002 \002(\01324.org.jetbrains.kotl" +
|
||||
"in.serialization.js.ast.NameTable\022E\n\010fra" +
|
||||
"gment\030\003 \002(\01323.org.jetbrains.kotlin.seria" +
|
||||
"lization.js.ast.Fragment*@\n\013SideEffects\022" +
|
||||
"\021\n\rAFFECTS_STATE\020\001\022\024\n\020DEPENDS_ON_STATE\020\002",
|
||||
"\022\010\n\004PURE\020\003*?\n\016InlineStrategy\022\017\n\013AS_FUNCT" +
|
||||
"ION\020\000\022\014\n\010IN_PLACE\020\001\022\016\n\nNOT_INLINE\020\002*\327\001\n\017" +
|
||||
"SpecialFunction\022\032\n\026DEFINE_INLINE_FUNCTIO" +
|
||||
"N\020\001\022\021\n\rWRAP_FUNCTION\020\002\022\021\n\rTO_BOXED_CHAR\020" +
|
||||
"\003\022\016\n\nUNBOX_CHAR\020\004\022\020\n\014SUSPEND_CALL\020\005\022\024\n\020C" +
|
||||
"OROUTINE_RESULT\020\006\022\030\n\024COROUTINE_CONTROLLE" +
|
||||
"R\020\007\022\026\n\022COROUTINE_RECEIVER\020\010\022\030\n\024SET_COROU" +
|
||||
"TINE_RESULT\020\tB\024B\022DebugJsAstProtoBuf"
|
||||
};
|
||||
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||
@@ -50138,7 +50701,7 @@ public final class DebugJsAstProtoBuf {
|
||||
internal_static_org_jetbrains_kotlin_serialization_js_ast_Fragment_fieldAccessorTable = new
|
||||
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||
internal_static_org_jetbrains_kotlin_serialization_js_ast_Fragment_descriptor,
|
||||
new java.lang.String[] { "ImportedModule", "ImportEntry", "DeclarationBlock", "ExportBlock", "InitializerBlock", "NameBinding", "ClassModel", "ModuleExpression", "InlineModule", });
|
||||
new java.lang.String[] { "ImportedModule", "ImportEntry", "DeclarationBlock", "ExportBlock", "InitializerBlock", "NameBinding", "ClassModel", "ModuleExpression", "InlineModule", "PackageFqn", "TestsInvocation", "MainInvocation", });
|
||||
internal_static_org_jetbrains_kotlin_serialization_js_ast_ImportedModule_descriptor =
|
||||
getDescriptor().getMessageTypes().get(46);
|
||||
internal_static_org_jetbrains_kotlin_serialization_js_ast_ImportedModule_fieldAccessorTable = new
|
||||
|
||||
@@ -88,6 +88,7 @@ class MainFunctionDetector {
|
||||
return isMain(functionDescriptor, checkJvmStaticAnnotation, allowParameterless = allowParameterless)
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun isMain(
|
||||
descriptor: DeclarationDescriptor,
|
||||
checkJvmStaticAnnotation: Boolean = true,
|
||||
|
||||
@@ -6,13 +6,15 @@ package org.jetbrains.kotlin.js.backend.ast
|
||||
|
||||
import java.util.*
|
||||
|
||||
class JsProgramFragment(val scope: JsScope) {
|
||||
val importedModules: MutableList<JsImportedModule> = ArrayList()
|
||||
class JsProgramFragment(val scope: JsScope, val packageFqn: String) {
|
||||
val importedModules = mutableListOf<JsImportedModule>()
|
||||
val imports: MutableMap<String, JsExpression> = LinkedHashMap()
|
||||
val declarationBlock = JsGlobalBlock()
|
||||
val exportBlock = JsGlobalBlock()
|
||||
val initializerBlock = JsGlobalBlock()
|
||||
val nameBindings: MutableList<JsNameBinding> = ArrayList()
|
||||
val nameBindings = mutableListOf<JsNameBinding>()
|
||||
val classes: MutableMap<JsName, JsClassModel> = LinkedHashMap()
|
||||
val inlineModuleMap: MutableMap<String, JsExpression> = LinkedHashMap()
|
||||
var tests: JsStatement? = null
|
||||
var mainFunction: JsStatement? = null
|
||||
}
|
||||
|
||||
@@ -106,6 +106,11 @@ public class JsInliner extends JsVisitorWithContextImpl {
|
||||
inliner.existingNameBindings = CollectUtilsKt.collectNameBindings(Collections.singletonList(fragment));
|
||||
|
||||
inliner.acceptStatement(fragment.getDeclarationBlock());
|
||||
// Mostly for the sake of post-processor
|
||||
// TODO are inline function marked with @Test possible?
|
||||
if (fragment.getTests() != null) {
|
||||
inliner.acceptStatement(fragment.getTests());
|
||||
}
|
||||
|
||||
// There can be inlined function in top-level initializers, we need to optimize them as well
|
||||
JsFunction fakeInitFunction = new JsFunction(JsDynamicScope.INSTANCE, fragment.getInitializerBlock(), "");
|
||||
|
||||
@@ -385,6 +385,9 @@ message Fragment {
|
||||
repeated ClassModel class_model = 7;
|
||||
repeated Expression module_expression = 8;
|
||||
repeated InlineModule inline_module = 9;
|
||||
optional string package_fqn = 10;
|
||||
optional Statement tests_invocation = 11;
|
||||
optional Statement main_invocation = 12;
|
||||
}
|
||||
|
||||
message ImportedModule {
|
||||
|
||||
@@ -56,7 +56,7 @@ class JsAstDeserializer(program: JsProgram, private val sourceRoots: Iterable<Fi
|
||||
}
|
||||
|
||||
private fun deserialize(proto: Fragment): JsProgramFragment {
|
||||
val fragment = JsProgramFragment(scope)
|
||||
val fragment = JsProgramFragment(scope, proto.packageFqn)
|
||||
|
||||
fragment.importedModules += proto.importedModuleList.map { importedModuleProto ->
|
||||
JsImportedModule(
|
||||
@@ -97,6 +97,14 @@ class JsAstDeserializer(program: JsProgram, private val sourceRoots: Iterable<Fi
|
||||
}
|
||||
}
|
||||
|
||||
if (proto.hasTestsInvocation()) {
|
||||
fragment.tests = deserialize(proto.testsInvocation)
|
||||
}
|
||||
|
||||
if (proto.hasMainInvocation()) {
|
||||
fragment.mainFunction = deserialize(proto.mainInvocation)
|
||||
}
|
||||
|
||||
return fragment
|
||||
}
|
||||
|
||||
|
||||
@@ -29721,6 +29721,38 @@ public final class JsAstProtoBuf {
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.js.ast.InlineModule inline_module = 9;</code>
|
||||
*/
|
||||
int getInlineModuleCount();
|
||||
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
boolean hasPackageFqn();
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
java.lang.String getPackageFqn();
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ByteString
|
||||
getPackageFqnBytes();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
boolean hasTestsInvocation();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement getTestsInvocation();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
boolean hasMainInvocation();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement getMainInvocation();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.js.ast.Fragment}
|
||||
@@ -29859,6 +29891,38 @@ public final class JsAstProtoBuf {
|
||||
inlineModule_.add(input.readMessage(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.InlineModule.PARSER, extensionRegistry));
|
||||
break;
|
||||
}
|
||||
case 82: {
|
||||
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
|
||||
bitField0_ |= 0x00000008;
|
||||
packageFqn_ = bs;
|
||||
break;
|
||||
}
|
||||
case 90: {
|
||||
org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
subBuilder = testsInvocation_.toBuilder();
|
||||
}
|
||||
testsInvocation_ = input.readMessage(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(testsInvocation_);
|
||||
testsInvocation_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000010;
|
||||
break;
|
||||
}
|
||||
case 98: {
|
||||
org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
subBuilder = mainInvocation_.toBuilder();
|
||||
}
|
||||
mainInvocation_ = input.readMessage(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(mainInvocation_);
|
||||
mainInvocation_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000020;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
|
||||
@@ -30166,6 +30230,78 @@ public final class JsAstProtoBuf {
|
||||
return inlineModule_.get(index);
|
||||
}
|
||||
|
||||
public static final int PACKAGE_FQN_FIELD_NUMBER = 10;
|
||||
private java.lang.Object packageFqn_;
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public boolean hasPackageFqn() {
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public java.lang.String getPackageFqn() {
|
||||
java.lang.Object ref = packageFqn_;
|
||||
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()) {
|
||||
packageFqn_ = s;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
getPackageFqnBytes() {
|
||||
java.lang.Object ref = packageFqn_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
org.jetbrains.kotlin.protobuf.ByteString b =
|
||||
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
packageFqn_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
|
||||
public static final int TESTS_INVOCATION_FIELD_NUMBER = 11;
|
||||
private org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement testsInvocation_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public boolean hasTestsInvocation() {
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement getTestsInvocation() {
|
||||
return testsInvocation_;
|
||||
}
|
||||
|
||||
public static final int MAIN_INVOCATION_FIELD_NUMBER = 12;
|
||||
private org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement mainInvocation_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public boolean hasMainInvocation() {
|
||||
return ((bitField0_ & 0x00000020) == 0x00000020);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement getMainInvocation() {
|
||||
return mainInvocation_;
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
importedModule_ = java.util.Collections.emptyList();
|
||||
importEntry_ = java.util.Collections.emptyList();
|
||||
@@ -30176,6 +30312,9 @@ public final class JsAstProtoBuf {
|
||||
classModel_ = java.util.Collections.emptyList();
|
||||
moduleExpression_ = java.util.Collections.emptyList();
|
||||
inlineModule_ = java.util.Collections.emptyList();
|
||||
packageFqn_ = "";
|
||||
testsInvocation_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance();
|
||||
mainInvocation_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance();
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
@@ -30237,6 +30376,18 @@ public final class JsAstProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTestsInvocation()) {
|
||||
if (!getTestsInvocation().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasMainInvocation()) {
|
||||
if (!getMainInvocation().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
@@ -30271,6 +30422,15 @@ public final class JsAstProtoBuf {
|
||||
for (int i = 0; i < inlineModule_.size(); i++) {
|
||||
output.writeMessage(9, inlineModule_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
output.writeBytes(10, getPackageFqnBytes());
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
output.writeMessage(11, testsInvocation_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
output.writeMessage(12, mainInvocation_);
|
||||
}
|
||||
output.writeRawBytes(unknownFields);
|
||||
}
|
||||
|
||||
@@ -30316,6 +30476,18 @@ public final class JsAstProtoBuf {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(9, inlineModule_.get(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeBytesSize(10, getPackageFqnBytes());
|
||||
}
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(11, testsInvocation_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(12, mainInvocation_);
|
||||
}
|
||||
size += unknownFields.size();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
@@ -30428,6 +30600,12 @@ public final class JsAstProtoBuf {
|
||||
bitField0_ = (bitField0_ & ~0x00000080);
|
||||
inlineModule_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000100);
|
||||
packageFqn_ = "";
|
||||
bitField0_ = (bitField0_ & ~0x00000200);
|
||||
testsInvocation_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance();
|
||||
bitField0_ = (bitField0_ & ~0x00000400);
|
||||
mainInvocation_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance();
|
||||
bitField0_ = (bitField0_ & ~0x00000800);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -30493,6 +30671,18 @@ public final class JsAstProtoBuf {
|
||||
bitField0_ = (bitField0_ & ~0x00000100);
|
||||
}
|
||||
result.inlineModule_ = inlineModule_;
|
||||
if (((from_bitField0_ & 0x00000200) == 0x00000200)) {
|
||||
to_bitField0_ |= 0x00000008;
|
||||
}
|
||||
result.packageFqn_ = packageFqn_;
|
||||
if (((from_bitField0_ & 0x00000400) == 0x00000400)) {
|
||||
to_bitField0_ |= 0x00000010;
|
||||
}
|
||||
result.testsInvocation_ = testsInvocation_;
|
||||
if (((from_bitField0_ & 0x00000800) == 0x00000800)) {
|
||||
to_bitField0_ |= 0x00000020;
|
||||
}
|
||||
result.mainInvocation_ = mainInvocation_;
|
||||
result.bitField0_ = to_bitField0_;
|
||||
return result;
|
||||
}
|
||||
@@ -30568,6 +30758,17 @@ public final class JsAstProtoBuf {
|
||||
}
|
||||
|
||||
}
|
||||
if (other.hasPackageFqn()) {
|
||||
bitField0_ |= 0x00000200;
|
||||
packageFqn_ = other.packageFqn_;
|
||||
|
||||
}
|
||||
if (other.hasTestsInvocation()) {
|
||||
mergeTestsInvocation(other.getTestsInvocation());
|
||||
}
|
||||
if (other.hasMainInvocation()) {
|
||||
mergeMainInvocation(other.getMainInvocation());
|
||||
}
|
||||
setUnknownFields(
|
||||
getUnknownFields().concat(other.unknownFields));
|
||||
return this;
|
||||
@@ -30628,6 +30829,18 @@ public final class JsAstProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasTestsInvocation()) {
|
||||
if (!getTestsInvocation().isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasMainInvocation()) {
|
||||
if (!getMainInvocation().isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -31580,6 +31793,202 @@ public final class JsAstProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
private java.lang.Object packageFqn_ = "";
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public boolean hasPackageFqn() {
|
||||
return ((bitField0_ & 0x00000200) == 0x00000200);
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public java.lang.String getPackageFqn() {
|
||||
java.lang.Object ref = packageFqn_;
|
||||
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()) {
|
||||
packageFqn_ = s;
|
||||
}
|
||||
return s;
|
||||
} else {
|
||||
return (java.lang.String) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.protobuf.ByteString
|
||||
getPackageFqnBytes() {
|
||||
java.lang.Object ref = packageFqn_;
|
||||
if (ref instanceof String) {
|
||||
org.jetbrains.kotlin.protobuf.ByteString b =
|
||||
org.jetbrains.kotlin.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
packageFqn_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (org.jetbrains.kotlin.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public Builder setPackageFqn(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
bitField0_ |= 0x00000200;
|
||||
packageFqn_ = value;
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public Builder clearPackageFqn() {
|
||||
bitField0_ = (bitField0_ & ~0x00000200);
|
||||
packageFqn_ = getDefaultInstance().getPackageFqn();
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional string package_fqn = 10;</code>
|
||||
*/
|
||||
public Builder setPackageFqnBytes(
|
||||
org.jetbrains.kotlin.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
bitField0_ |= 0x00000200;
|
||||
packageFqn_ = value;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement testsInvocation_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public boolean hasTestsInvocation() {
|
||||
return ((bitField0_ & 0x00000400) == 0x00000400);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement getTestsInvocation() {
|
||||
return testsInvocation_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public Builder setTestsInvocation(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
testsInvocation_ = value;
|
||||
|
||||
bitField0_ |= 0x00000400;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public Builder setTestsInvocation(
|
||||
org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.Builder builderForValue) {
|
||||
testsInvocation_ = builderForValue.build();
|
||||
|
||||
bitField0_ |= 0x00000400;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public Builder mergeTestsInvocation(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement value) {
|
||||
if (((bitField0_ & 0x00000400) == 0x00000400) &&
|
||||
testsInvocation_ != org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance()) {
|
||||
testsInvocation_ =
|
||||
org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.newBuilder(testsInvocation_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
testsInvocation_ = value;
|
||||
}
|
||||
|
||||
bitField0_ |= 0x00000400;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement tests_invocation = 11;</code>
|
||||
*/
|
||||
public Builder clearTestsInvocation() {
|
||||
testsInvocation_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance();
|
||||
|
||||
bitField0_ = (bitField0_ & ~0x00000400);
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement mainInvocation_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public boolean hasMainInvocation() {
|
||||
return ((bitField0_ & 0x00000800) == 0x00000800);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement getMainInvocation() {
|
||||
return mainInvocation_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public Builder setMainInvocation(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
mainInvocation_ = value;
|
||||
|
||||
bitField0_ |= 0x00000800;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public Builder setMainInvocation(
|
||||
org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.Builder builderForValue) {
|
||||
mainInvocation_ = builderForValue.build();
|
||||
|
||||
bitField0_ |= 0x00000800;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public Builder mergeMainInvocation(org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement value) {
|
||||
if (((bitField0_ & 0x00000800) == 0x00000800) &&
|
||||
mainInvocation_ != org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance()) {
|
||||
mainInvocation_ =
|
||||
org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.newBuilder(mainInvocation_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
mainInvocation_ = value;
|
||||
}
|
||||
|
||||
bitField0_ |= 0x00000800;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.js.ast.Statement main_invocation = 12;</code>
|
||||
*/
|
||||
public Builder clearMainInvocation() {
|
||||
mainInvocation_ = org.jetbrains.kotlin.serialization.js.ast.JsAstProtoBuf.Statement.getDefaultInstance();
|
||||
|
||||
bitField0_ = (bitField0_ & ~0x00000800);
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.js.ast.Fragment)
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,8 @@ class JsAstSerializer(private val pathResolver: (File) -> String) {
|
||||
private fun serializeFragment(fragment: JsProgramFragment): Fragment {
|
||||
val fragmentBuilder = Fragment.newBuilder()
|
||||
|
||||
fragmentBuilder.packageFqn = fragment.packageFqn
|
||||
|
||||
for (importedModule in fragment.importedModules) {
|
||||
val importedModuleBuilder = ImportedModule.newBuilder()
|
||||
importedModuleBuilder.externalNameId = serialize(importedModule.externalName)
|
||||
@@ -102,6 +104,14 @@ class JsAstSerializer(private val pathResolver: (File) -> String) {
|
||||
fragmentBuilder.addInlineModule(inlineModuleBuilder)
|
||||
}
|
||||
|
||||
fragment.tests?.let {
|
||||
fragmentBuilder.setTestsInvocation(serialize(it))
|
||||
}
|
||||
|
||||
fragment.mainFunction?.let {
|
||||
fragmentBuilder.setMainInvocation(serialize(it))
|
||||
}
|
||||
|
||||
return fragmentBuilder.build()
|
||||
}
|
||||
|
||||
|
||||
@@ -158,11 +158,12 @@ public final class StaticContext {
|
||||
@NotNull BindingTrace bindingTrace,
|
||||
@NotNull JsConfig config,
|
||||
@NotNull ModuleDescriptor moduleDescriptor,
|
||||
@NotNull SourceFilePathResolver sourceFilePathResolver
|
||||
@NotNull SourceFilePathResolver sourceFilePathResolver,
|
||||
@NotNull String packageFqn
|
||||
) {
|
||||
program = new JsProgram();
|
||||
JsFunction rootFunction = JsAstUtils.createFunctionWithEmptyBody(program.getScope());
|
||||
fragment = new JsProgramFragment(rootFunction.getScope());
|
||||
fragment = new JsProgramFragment(rootFunction.getScope(), packageFqn);
|
||||
|
||||
this.bindingTrace = bindingTrace;
|
||||
this.namer = Namer.newInstance(program.getRootScope());
|
||||
|
||||
@@ -34,6 +34,8 @@ class Merger(private val rootFunction: JsFunction, val internalModuleName: JsNam
|
||||
val importBlock = JsGlobalBlock()
|
||||
private val declarationBlock = JsGlobalBlock()
|
||||
private val initializerBlock = JsGlobalBlock()
|
||||
private val testsMap = mutableMapOf<String, JsStatement>()
|
||||
private var mainFn: Pair<String, JsStatement>? = null
|
||||
private val exportBlock = JsGlobalBlock()
|
||||
private val declaredImports = mutableSetOf<String>()
|
||||
private val classes = mutableMapOf<JsName, JsClassModel>()
|
||||
@@ -55,11 +57,42 @@ class Merger(private val rootFunction: JsFunction, val internalModuleName: JsNam
|
||||
|
||||
declarationBlock.statements += fragment.declarationBlock
|
||||
initializerBlock.statements += fragment.initializerBlock
|
||||
fragment.tryUpdateTests()
|
||||
fragment.tryUpdateMain()
|
||||
addExportStatements(fragment)
|
||||
|
||||
classes += fragment.classes
|
||||
}
|
||||
|
||||
private fun JsProgramFragment.tryUpdateTests() {
|
||||
tests?.let { newTests ->
|
||||
testsMap.putIfAbsent(packageFqn, newTests)?.let { oldTests ->
|
||||
oldTests.decomposeTestInvocation()?.let {oldTestBody ->
|
||||
newTests.decomposeTestInvocation()?.let { newTestBody ->
|
||||
oldTestBody.statements += newTestBody.statements
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun JsStatement.decomposeTestInvocation(): JsBlock? {
|
||||
return (this as? JsExpressionStatement)?.let {
|
||||
(it.expression as? JsInvocation)?.let {
|
||||
(it.arguments[2] as? JsFunction)?.body
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun JsProgramFragment.tryUpdateMain() {
|
||||
mainFunction?.let { m ->
|
||||
val currentMainFqn = mainFn?.first
|
||||
if (currentMainFqn == null || currentMainFqn > packageFqn) {
|
||||
mainFn = packageFqn to m
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val importedModules: List<JsImportedModule>
|
||||
get() = importedModulesImpl
|
||||
|
||||
@@ -136,6 +169,9 @@ class Merger(private val rootFunction: JsFunction, val internalModuleName: JsNam
|
||||
fragment.classes += classes.map { it.name to it }
|
||||
|
||||
fragment.inlineModuleMap.forEach { (_, value) -> rename(value) }
|
||||
|
||||
fragment.tests?.let { rename(it) }
|
||||
fragment.mainFunction?.let { rename(it) }
|
||||
}
|
||||
|
||||
private fun <T: JsNode> Map<JsName, JsName>.rename(rootNode: T): T {
|
||||
@@ -174,6 +210,8 @@ class Merger(private val rootFunction: JsFunction, val internalModuleName: JsNam
|
||||
this += exportBlock.statements
|
||||
addClassPostDeclarations(this)
|
||||
this += initializerBlock.statements
|
||||
this += testsMap.values
|
||||
mainFn?.second?.let { this += it }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -340,15 +340,21 @@ public final class Translation {
|
||||
for (TranslationUnit unit : units) {
|
||||
if (unit instanceof TranslationUnit.SourceFile) {
|
||||
KtFile file = ((TranslationUnit.SourceFile) unit).getFile();
|
||||
StaticContext staticContext = new StaticContext(bindingTrace, config, moduleDescriptor, sourceFilePathResolver);
|
||||
StaticContext staticContext = new StaticContext(bindingTrace, config, moduleDescriptor, sourceFilePathResolver, file.getPackageFqName().asString());
|
||||
TranslationContext context = TranslationContext.rootContext(staticContext);
|
||||
List<DeclarationDescriptor> fileMemberScope = new ArrayList<>();
|
||||
translateFile(context, file, fileMemberScope);
|
||||
fragments.add(staticContext.getFragment());
|
||||
newFragments.add(staticContext.getFragment());
|
||||
fragmentMap.put(file, staticContext.getFragment());
|
||||
|
||||
JsProgramFragment fragment = staticContext.getFragment();
|
||||
|
||||
fragment.setTests(mayBeGenerateTests(context, file, fileMemberScope));
|
||||
fragment.setMainFunction(maybeGenerateCallToMain(context, config, moduleDescriptor, fileMemberScope, mainCallParameters));
|
||||
|
||||
fragments.add(fragment);
|
||||
newFragments.add(fragment);
|
||||
fragmentMap.put(file, fragment);
|
||||
fileMemberScopes.put(file, fileMemberScope);
|
||||
merger.addFragment(staticContext.getFragment());
|
||||
merger.addFragment(fragment);
|
||||
}
|
||||
else if (unit instanceof TranslationUnit.BinaryAst) {
|
||||
byte[] astData = ((TranslationUnit.BinaryAst) unit).getData();
|
||||
@@ -358,22 +364,8 @@ public final class Translation {
|
||||
}
|
||||
}
|
||||
|
||||
JsProgramFragment testFragment = mayBeGenerateTests(config, bindingTrace, moduleDescriptor, sourceFilePathResolver);
|
||||
fragments.add(testFragment);
|
||||
newFragments.add(testFragment);
|
||||
merger.addFragment(testFragment);
|
||||
rootFunction.getParameters().add(new JsParameter(internalModuleName));
|
||||
|
||||
if (mainCallParameters.shouldBeGenerated()) {
|
||||
JsProgramFragment mainCallFragment = generateCallToMain(
|
||||
bindingTrace, config, moduleDescriptor, sourceFilePathResolver, mainCallParameters.arguments());
|
||||
if (mainCallFragment != null) {
|
||||
fragments.add(mainCallFragment);
|
||||
newFragments.add(mainCallFragment);
|
||||
merger.addFragment(mainCallFragment);
|
||||
}
|
||||
}
|
||||
|
||||
merger.merge();
|
||||
|
||||
JsBlock rootBlock = rootFunction.getBody();
|
||||
@@ -447,30 +439,36 @@ public final class Translation {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static JsProgramFragment mayBeGenerateTests(
|
||||
@NotNull JsConfig config, @NotNull BindingTrace trace,
|
||||
@NotNull ModuleDescriptor moduleDescriptor, @NotNull SourceFilePathResolver sourceFilePathResolver
|
||||
@Nullable
|
||||
private static JsStatement mayBeGenerateTests(
|
||||
@NotNull TranslationContext context,
|
||||
@NotNull KtFile file,
|
||||
@NotNull List<DeclarationDescriptor> fileMemberScope
|
||||
) {
|
||||
StaticContext staticContext = new StaticContext(trace, config, moduleDescriptor, sourceFilePathResolver);
|
||||
TranslationContext context = TranslationContext.rootContext(staticContext);
|
||||
|
||||
new JSTestGenerator(context).generateTestCalls(moduleDescriptor);
|
||||
|
||||
return staticContext.getFragment();
|
||||
return new JSTestGenerator(context).generateTestCalls(file, fileMemberScope);
|
||||
}
|
||||
|
||||
//TODO: determine whether should throw exception
|
||||
@Nullable
|
||||
private static JsProgramFragment generateCallToMain(
|
||||
@NotNull BindingTrace trace, @NotNull JsConfig config, @NotNull ModuleDescriptor moduleDescriptor,
|
||||
@NotNull SourceFilePathResolver sourceFilePathResolver,
|
||||
@NotNull List<String> arguments
|
||||
private static JsStatement maybeGenerateCallToMain(
|
||||
@NotNull TranslationContext context,
|
||||
@NotNull JsConfig config,
|
||||
@NotNull ModuleDescriptor moduleDescriptor,
|
||||
@NotNull List<DeclarationDescriptor> fileMemberScope,
|
||||
@NotNull MainCallParameters mainCallParameters
|
||||
) {
|
||||
StaticContext staticContext = new StaticContext(trace, config, moduleDescriptor, sourceFilePathResolver);
|
||||
TranslationContext context = TranslationContext.rootContext(staticContext);
|
||||
if (!mainCallParameters.shouldBeGenerated()) return null;
|
||||
|
||||
MainFunctionDetector mainFunctionDetector = new MainFunctionDetector(context.bindingContext(), config.getLanguageVersionSettings());
|
||||
FunctionDescriptor functionDescriptor = mainFunctionDetector.getMainFunction(moduleDescriptor);
|
||||
|
||||
FunctionDescriptor functionDescriptor = null;
|
||||
|
||||
for (DeclarationDescriptor d : fileMemberScope) {
|
||||
if (mainFunctionDetector.isMain(d)) {
|
||||
functionDescriptor = (FunctionDescriptor)d;
|
||||
}
|
||||
}
|
||||
|
||||
if (functionDescriptor == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -480,7 +478,7 @@ public final class Translation {
|
||||
|
||||
List<JsExpression> args = new ArrayList<>();
|
||||
if (parameterCount != 0) {
|
||||
args.add(new JsArrayLiteral(toStringLiteralList(arguments)));
|
||||
args.add(new JsArrayLiteral(toStringLiteralList(mainCallParameters.arguments())));
|
||||
}
|
||||
|
||||
if (functionDescriptor.isSuspend()) {
|
||||
@@ -492,7 +490,6 @@ public final class Translation {
|
||||
}
|
||||
|
||||
JsExpression call = CallTranslator.INSTANCE.buildCall(context, functionDescriptor, args, null);
|
||||
context.addTopLevelStatement(call.makeStmt());
|
||||
return staticContext.getFragment();
|
||||
return call.makeStmt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,14 +24,25 @@ import org.jetbrains.kotlin.js.translate.reference.ReferenceTranslator
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.FqNameUnsafe
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
|
||||
class JSTestGenerator(val context: TranslationContext) {
|
||||
|
||||
fun generateTestCalls(moduleDescriptor: ModuleDescriptor) {
|
||||
generateTestCalls(moduleDescriptor, FqName.ROOT)
|
||||
fun generateTestCalls(file: KtFile, fileMemberScope: List<DeclarationDescriptor>): JsStatement? {
|
||||
val testsFunction = JsFunction(context.scope(), JsBlock(), "${file.virtualFilePath} file suite function")
|
||||
fileMemberScope.forEach {
|
||||
if (it is ClassDescriptor) {
|
||||
generateTestFunctions(it, testsFunction)
|
||||
}
|
||||
}
|
||||
if (!testsFunction.body.isEmpty) {
|
||||
val suiteName = JsStringLiteral(file.packageFqName.asString())
|
||||
return JsInvocation(suiteRef, suiteName, JsBooleanLiteral(false), testsFunction).makeStmt()
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun generateTestCalls(moduleDescriptor: ModuleDescriptor, packageName: FqName) {
|
||||
|
||||
Reference in New Issue
Block a user