Reorganize stdlib-js sources specific to the current JS backend

Move kotlin-stdlib-js project and the sources specific to the current backend to 'stdlib/js-v1' directory,
but leave sources that can be shared with the new IR backend in the common 'stdlib/js' location
with exception for 'stdlib/js/src/generated', which is used exclusively for current backend.
This simplifies sourceset configuration when building stdlib with the new backend.
This commit is contained in:
Svyatoslav Kuzmich
2019-04-11 16:25:40 +03:00
parent 9dd9efd4aa
commit b1d303b027
70 changed files with 72 additions and 115 deletions
@@ -0,0 +1,85 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
/**
* @param {string} id
* @param {Object} declaration
*/
Kotlin.defineModule = function (id, declaration) {
};
Kotlin.defineInlineFunction = function(tag, fun) {
return fun;
};
Kotlin.wrapFunction = function(fun) {
var f = function() {
f = fun();
return f.apply(this, arguments);
};
return function() {
return f.apply(this, arguments);
};
};
Kotlin.isTypeOf = function(type) {
return function (object) {
return typeof object === type;
}
};
Kotlin.isInstanceOf = function (klass) {
return function (object) {
return Kotlin.isType(object, klass);
}
};
Kotlin.orNull = function (fn) {
return function (object) {
return object == null || fn(object);
}
};
Kotlin.andPredicate = function (a, b) {
return function (object) {
return a(object) && b(object);
}
};
Kotlin.kotlinModuleMetadata = function (abiVersion, moduleName, data) {
};
Kotlin.suspendCall = function(value) {
return 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;
}
};