From 63e7d60ad77655e271832c492df7dda1f1b78509 Mon Sep 17 00:00:00 2001 From: Erokhin Stanislav Date: Tue, 17 Sep 2013 18:45:18 +0400 Subject: [PATCH] JS backend: fix KotlinLibTest --- .../testFiles/kotlinLib/cases/namespace.js | 10 ++--- .../kotlinLib/cases/namespaceWithClasses.js | 39 ++++++++++--------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/js/js.translator/testFiles/kotlinLib/cases/namespace.js b/js/js.translator/testFiles/kotlinLib/cases/namespace.js index f0b1455256c..015c2b4ef75 100644 --- a/js/js.translator/testFiles/kotlinLib/cases/namespace.js +++ b/js/js.translator/testFiles/kotlinLib/cases/namespace.js @@ -14,11 +14,11 @@ * limitations under the License. */ -var foo = Kotlin.definePackage({initialize: function () { -}, box: function () { - return !false; -} - }); +var foo = Kotlin.defineRootPackage(null, { + box: function () { + return !false; + } + }); function test() { return foo.box() diff --git a/js/js.translator/testFiles/kotlinLib/cases/namespaceWithClasses.js b/js/js.translator/testFiles/kotlinLib/cases/namespaceWithClasses.js index 9743bac3b4d..3a1e2ad8b8f 100644 --- a/js/js.translator/testFiles/kotlinLib/cases/namespaceWithClasses.js +++ b/js/js.translator/testFiles/kotlinLib/cases/namespaceWithClasses.js @@ -16,40 +16,41 @@ { var items = function () { - var A = Kotlin.createClass(null, {initialize: function () { - this.$order = ''; + var A = Kotlin.createClass(null, + function $fun() { + this.$order = ''; + { + this.set_order(this.get_order() + 'A'); + } + }, { - this.set_order(this.get_order() + 'A'); - } - }, set_order: function (tmp$0) { - this.$order = tmp$0; - }, get_order: function () { - return this.$order; - } - }); - var B = Kotlin.createClass(A, {initialize: function () { - this.super_init(); + set_order: function (tmp$0) { + this.$order = tmp$0; + }, + get_order: function () { + return this.$order; + } + }); + var B = Kotlin.createClass(A, function $fun() { + $fun.baseInitializer.call(this); { this.set_order(this.get_order() + 'B'); } - } }); - var C = Kotlin.createClass(B, {initialize: function () { - this.super_init(); + var C = Kotlin.createClass(B, function $fun() { + $fun.baseInitializer.call(this); { this.set_order(this.get_order() + 'C'); } - } }); return {A: A, B: B, C: C}; - } - (); + }(); items.box = function () { return (new foo.C).get_order() === 'ABC' && (new foo.B).get_order() === 'AB' && (new foo.A).get_order() === 'A'; }; - var foo = Kotlin.definePackage(items); + var foo = Kotlin.defineRootPackage(null, items); } function test() {