JS: fix reified T::class for primitive T (e.g. Int) (KT-32215 fixed)

This commit is contained in:
Anton Bannykh
2019-06-27 17:28:41 +03:00
parent d972d50296
commit fadeac083f
17 changed files with 163 additions and 12 deletions
+1
View File
@@ -464,6 +464,7 @@ enum SpecialFunction {
COROUTINE_CONTROLLER = 7;
COROUTINE_RECEIVER = 8;
SET_COROUTINE_RESULT = 9;
GET_KCLASS = 10;
}
@@ -557,6 +557,7 @@ class JsAstDeserializer(program: JsProgram, private val sourceRoots: Iterable<Fi
JsAstProtoBuf.SpecialFunction.COROUTINE_CONTROLLER -> SpecialFunction.COROUTINE_CONTROLLER
JsAstProtoBuf.SpecialFunction.COROUTINE_RECEIVER -> SpecialFunction.COROUTINE_RECEIVER
JsAstProtoBuf.SpecialFunction.SET_COROUTINE_RESULT -> SpecialFunction.SET_COROUTINE_RESULT
JsAstProtoBuf.SpecialFunction.GET_KCLASS -> SpecialFunction.GET_KCLASS
}
private fun <T : JsNode> withLocation(fileId: Int?, location: Location?, action: () -> T): T {
@@ -179,6 +179,10 @@ public final class JsAstProtoBuf {
* <code>SET_COROUTINE_RESULT = 9;</code>
*/
SET_COROUTINE_RESULT(8, 9),
/**
* <code>GET_KCLASS = 10;</code>
*/
GET_KCLASS(9, 10),
;
/**
@@ -217,6 +221,10 @@ public final class JsAstProtoBuf {
* <code>SET_COROUTINE_RESULT = 9;</code>
*/
public static final int SET_COROUTINE_RESULT_VALUE = 9;
/**
* <code>GET_KCLASS = 10;</code>
*/
public static final int GET_KCLASS_VALUE = 10;
public final int getNumber() { return value; }
@@ -232,6 +240,7 @@ public final class JsAstProtoBuf {
case 7: return COROUTINE_CONTROLLER;
case 8: return COROUTINE_RECEIVER;
case 9: return SET_COROUTINE_RESULT;
case 10: return GET_KCLASS;
default: return null;
}
}
@@ -599,6 +599,7 @@ class JsAstSerializer(private val jsAstValidator: ((JsProgramFragment, Set<JsNam
SpecialFunction.COROUTINE_CONTROLLER -> JsAstProtoBuf.SpecialFunction.COROUTINE_CONTROLLER
SpecialFunction.COROUTINE_RECEIVER -> JsAstProtoBuf.SpecialFunction.COROUTINE_RECEIVER
SpecialFunction.SET_COROUTINE_RESULT -> JsAstProtoBuf.SpecialFunction.SET_COROUTINE_RESULT
SpecialFunction.GET_KCLASS -> JsAstProtoBuf.SpecialFunction.GET_KCLASS
}
private fun serialize(name: JsName): Int = nameMap.getOrPut(name) {