From a452260da6d55f3c65a0bdf9893859411408f9b5 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 27 Oct 2016 14:31:53 +0300 Subject: [PATCH] JS: simplify merging kotlin.js --- build.xml | 22 +++++++++++-------- js/js.translator/testData/closure-wrapper.txt | 19 ++++++++-------- js/js.translator/testData/kotlin_lib_ecma5.js | 9 ++------ 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/build.xml b/build.xml index 0bddfa35f98..d78957ae3be 100644 --- a/build.xml +++ b/build.xml @@ -375,6 +375,19 @@ + + + + @@ -401,15 +414,6 @@ - - - diff --git a/js/js.translator/testData/closure-wrapper.txt b/js/js.translator/testData/closure-wrapper.txt index e5156814ebe..f121928f0b5 100644 --- a/js/js.translator/testData/closure-wrapper.txt +++ b/js/js.translator/testData/closure-wrapper.txt @@ -1,15 +1,16 @@ (function (root, factory) { if (typeof define === 'function' && define.amd) { - define('kotlin', [], factory); - } else if (typeof exports === 'object') { - module.exports = factory(); - } else { - root.kotlin = factory(); + define('kotlin', ['exports'], factory); } -}(this, function () { - var Kotlin = {}; + else if (typeof exports === 'object') { + factory(module.exports); + } + else { + root.kotlin = {}; + factory(root.kotlin); + } +}(this, function (Kotlin) { + var _ = Kotlin; %output% - - return Kotlin; })); \ No newline at end of file diff --git a/js/js.translator/testData/kotlin_lib_ecma5.js b/js/js.translator/testData/kotlin_lib_ecma5.js index 9e2cd9f3969..9d6630b8326 100644 --- a/js/js.translator/testData/kotlin_lib_ecma5.js +++ b/js/js.translator/testData/kotlin_lib_ecma5.js @@ -14,9 +14,7 @@ * limitations under the License. */ -(function (Kotlin) { - 'use strict'; - +(function () { function toArray(obj) { var array; if (obj == null) { @@ -613,9 +611,6 @@ * @param {Object} declaration */ Kotlin.defineModule = function (id, declaration) { - if (typeof declaration.$initializer$ === "function") { - declaration.$initializer$.call(declaration); // TODO: temporary hack - } Kotlin.modules[id] = declaration; }; @@ -656,4 +651,4 @@ Kotlin.kotlinModuleMetadata = function (abiVersion, moduleName, data) { }; -})(Kotlin); +})();