KT-12877: initial simple implementation of JsModule. Remove unnecessary ModuleDescriptor from several classes in pipeline

This commit is contained in:
Alexey Andreev
2016-06-28 14:40:49 +03:00
committed by Alexey Andreev
parent 75d80acac9
commit 6df40559f0
14 changed files with 167 additions and 12 deletions
@@ -0,0 +1,12 @@
package foo
@JsModule("lib") @native class A(@native val x: Int = noImpl) {
@native fun foo(y: Int): Int = noImpl
}
fun box(): String {
val a = A(23)
assertEquals(23, a.x)
assertEquals(65, a.foo(42))
return "OK"
}
@@ -0,0 +1,8 @@
package foo
@JsModule("lib") @native fun foo(y: Int): Int = noImpl
fun box(): String {
assertEquals(65, foo(42))
return "OK"
}
@@ -0,0 +1,13 @@
package foo
@JsModule("lib") @native object A {
@native val x: Int = noImpl
@native fun foo(y: Int): Int = noImpl
}
fun box(): String {
assertEquals(23, A.x)
assertEquals(65, A.foo(42))
return "OK"
}
@@ -0,0 +1,8 @@
package foo
@JsModule("lib") @native val foo: Int = noImpl
fun box(): String {
assertEquals(23, foo)
return "OK"
}
@@ -0,0 +1,10 @@
define("lib", [], function() {
function A(x) {
this.x = x;
}
A.prototype.foo = function (y) {
return this.x + y;
};
return A;
});
@@ -0,0 +1,5 @@
define("lib", [], function() {
return function(y) {
return 23 + y;
};
});
@@ -0,0 +1,10 @@
define("lib", [], function() {
A = {
x: 23,
foo: function(y) {
return this.x + y;
}
};
return A;
});
@@ -0,0 +1,3 @@
define("lib", [], function() {
return 23;
});