JS: replace suspend inline metadata after inlining

This fixes some issues on coroutine inlining, see tests
This commit is contained in:
Alexey Andreev
2017-11-03 14:35:39 +03:00
parent f8e7861ce6
commit 71b1591044
21 changed files with 344 additions and 60 deletions
+1
View File
@@ -440,6 +440,7 @@ enum SpecialFunction {
COROUTINE_RESULT = 6;
COROUTINE_CONTROLLER = 7;
COROUTINE_RECEIVER = 8;
SET_COROUTINE_RESULT = 9;
}
@@ -527,6 +527,7 @@ class JsAstDeserializer(program: JsProgram, private val sourceRoots: Iterable<Fi
JsAstProtoBuf.SpecialFunction.COROUTINE_RESULT -> SpecialFunction.COROUTINE_RESULT
JsAstProtoBuf.SpecialFunction.COROUTINE_CONTROLLER -> SpecialFunction.COROUTINE_CONTROLLER
JsAstProtoBuf.SpecialFunction.COROUTINE_RECEIVER -> SpecialFunction.COROUTINE_RECEIVER
JsAstProtoBuf.SpecialFunction.SET_COROUTINE_RESULT -> SpecialFunction.SET_COROUTINE_RESULT
}
private fun <T : JsNode> withLocation(fileId: Int?, location: Location?, action: () -> T): T {
@@ -175,6 +175,10 @@ public final class JsAstProtoBuf {
* <code>COROUTINE_RECEIVER = 8;</code>
*/
COROUTINE_RECEIVER(7, 8),
/**
* <code>SET_COROUTINE_RESULT = 9;</code>
*/
SET_COROUTINE_RESULT(8, 9),
;
/**
@@ -209,6 +213,10 @@ public final class JsAstProtoBuf {
* <code>COROUTINE_RECEIVER = 8;</code>
*/
public static final int COROUTINE_RECEIVER_VALUE = 8;
/**
* <code>SET_COROUTINE_RESULT = 9;</code>
*/
public static final int SET_COROUTINE_RESULT_VALUE = 9;
public final int getNumber() { return value; }
@@ -223,6 +231,7 @@ public final class JsAstProtoBuf {
case 6: return COROUTINE_RESULT;
case 7: return COROUTINE_CONTROLLER;
case 8: return COROUTINE_RECEIVER;
case 9: return SET_COROUTINE_RESULT;
default: return null;
}
}
@@ -563,6 +563,7 @@ class JsAstSerializer(private val pathResolver: (File) -> String) {
SpecialFunction.COROUTINE_RESULT -> JsAstProtoBuf.SpecialFunction.COROUTINE_RESULT
SpecialFunction.COROUTINE_CONTROLLER -> JsAstProtoBuf.SpecialFunction.COROUTINE_CONTROLLER
SpecialFunction.COROUTINE_RECEIVER -> JsAstProtoBuf.SpecialFunction.COROUTINE_RECEIVER
SpecialFunction.SET_COROUTINE_RESULT -> JsAstProtoBuf.SpecialFunction.SET_COROUTINE_RESULT
}
private fun serialize(name: JsName): Int = nameMap.getOrPut(name) {