Files
kotlin-fork/js/js.translator/testFiles/kotlinLib/cases/namespaceWithClasses.js
T
develar d4d300d0e9 Requested only one commit pull request (was: https://github.com/JetBrains/kotlin/pull/59/files).
Note: all tests passed, but I haven't tested this build in real life (opposite to my master branch).

Don't remember about critical issue — http://youtrack.jetbrains.com/issue/KT-2154 Fix for this issue is not included in this patch (because unrelated). Fix for it and for all other unrelated changes will be opened as separated pull-requests.
2012-06-05 19:29:20 +04:00

60 lines
1.5 KiB
JavaScript

/*
* Copyright 2010-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
classes = function(){
var A = Kotlin.createClass({initialize:function(){
this.$order = '';
{
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();
{
this.set_order(this.get_order() + 'B');
}
}
});
var C = Kotlin.createClass(B, {initialize:function(){
this.super_init();
{
this.set_order(this.get_order() + 'C');
}
}
});
return {A:A, B:B, C:C};
}
();
foo = Kotlin.createNamespace(classes, {initialize:function(){
}
, box:function(){
return (new foo.C).get_order() === 'ABC' && (new foo.B).get_order() === 'AB' && (new foo.A).get_order() === 'A';
}
});
}
function test() {
return foo.box()
}