From be4e2f96c2ff49635df6424f8dab4d27a8476b5e Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Fri, 24 Nov 2017 12:24:16 +0300 Subject: [PATCH] JS: throw error from coroutine marker functions --- js/js.libraries/src/js/markerFunctions.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/js.libraries/src/js/markerFunctions.js b/js/js.libraries/src/js/markerFunctions.js index 15c2fc30754..ff2bb808a73 100644 --- a/js/js.libraries/src/js/markerFunctions.js +++ b/js/js.libraries/src/js/markerFunctions.js @@ -67,17 +67,28 @@ Kotlin.suspendCall = function(value) { }; Kotlin.coroutineResult = function(qualifier) { + throwMarkerError(); }; Kotlin.coroutineController = function(qualifier) { + throwMarkerError(); }; Kotlin.coroutineReceiver = function(qualifier) { + throwMarkerError(); }; Kotlin.setCoroutineResult = function(value, qualifier) { + throwMarkerError(); }; +function throwMarkerError() { + throw new Error( + "This marker function should never been called. " + + "Looks like compiler did not eliminate it properly. " + + "Please, report an issue if you caught this exception."); +} + Kotlin.getFunctionById = function(id, defaultValue) { return function() { return defaultValue;