KT-12877: serialize information about file annotations. For each top-level declaration store containing file. Use this information to properly handle file-targeted JsModule.
This commit is contained in:
committed by
Alexey Andreev
parent
6df40559f0
commit
ac703dfda6
+4
-1
@@ -1,6 +1,8 @@
|
||||
// MODULE_KIND: AMD
|
||||
package foo
|
||||
|
||||
@JsModule("lib") @native class A(@native val x: Int = noImpl) {
|
||||
@JsModule("lib")
|
||||
@native class A(@native val x: Int = noImpl) {
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
}
|
||||
|
||||
@@ -8,5 +10,6 @@ fun box(): String {
|
||||
val a = A(23)
|
||||
assertEquals(23, a.x)
|
||||
assertEquals(65, a.foo(42))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
// MODULE_KIND: AMD
|
||||
package foo
|
||||
|
||||
@JsModule("lib") @native fun foo(y: Int): Int = noImpl
|
||||
@JsModule("lib")
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(65, foo(42))
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
// MODULE_KIND: AMD
|
||||
package foo
|
||||
|
||||
@JsModule("lib") @native object A {
|
||||
@JsModule("lib")
|
||||
@native object A {
|
||||
@native val x: Int = noImpl
|
||||
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
@@ -0,0 +1,28 @@
|
||||
define("lib", [], function() {
|
||||
function A(x) {
|
||||
this.x = x;
|
||||
}
|
||||
A.prototype.foo = function (y) {
|
||||
return this.x + y;
|
||||
};
|
||||
|
||||
B = {
|
||||
x: 123,
|
||||
foo: function(y) {
|
||||
return this.x + y;
|
||||
}
|
||||
};
|
||||
|
||||
function foo(y) {
|
||||
return 323 + y;
|
||||
}
|
||||
|
||||
var bar = 423;
|
||||
|
||||
return {
|
||||
A: A,
|
||||
B: B,
|
||||
foo: foo,
|
||||
bar: bar
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
// MODULE_KIND: AMD
|
||||
@file:JsModule("lib")
|
||||
package foo
|
||||
|
||||
@native class A(@native val x: Int = noImpl) {
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
}
|
||||
|
||||
@native object B {
|
||||
@native val x: Int = noImpl
|
||||
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
}
|
||||
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
|
||||
@native val bar: Int = noImpl
|
||||
|
||||
fun box(): String {
|
||||
val a = A(23)
|
||||
assertEquals(23, a.x)
|
||||
assertEquals(65, a.foo(42))
|
||||
|
||||
assertEquals(123, B.x)
|
||||
assertEquals(265, B.foo(142))
|
||||
|
||||
assertEquals(365, foo(23))
|
||||
assertEquals(423, bar)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
define("lib", [], function() {
|
||||
function A(x) {
|
||||
this.x = x;
|
||||
}
|
||||
A.prototype.foo = function (y) {
|
||||
return this.x + y;
|
||||
};
|
||||
|
||||
B = {
|
||||
x: 123,
|
||||
foo: function(y) {
|
||||
return this.x + y;
|
||||
}
|
||||
};
|
||||
|
||||
function foo(y) {
|
||||
return 323 + y;
|
||||
}
|
||||
|
||||
var bar = 423;
|
||||
|
||||
return {
|
||||
A: A,
|
||||
B: B,
|
||||
foo: foo,
|
||||
bar: bar
|
||||
};
|
||||
});
|
||||
|
||||
C = {
|
||||
f: function() {
|
||||
return 12345;
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
// MODULE_KIND: AMD
|
||||
// FILE: lib.kt
|
||||
@file:JsModule("lib")
|
||||
package foo
|
||||
|
||||
@native class A(@native val x: Int = noImpl) {
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
}
|
||||
|
||||
@native object B {
|
||||
@native val x: Int = noImpl
|
||||
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
}
|
||||
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
|
||||
@native val bar: Int = noImpl
|
||||
|
||||
// FILE: lib2.kt
|
||||
package foo
|
||||
|
||||
@native object C {
|
||||
fun f(): Int = noImpl
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val a = A(23)
|
||||
assertEquals(23, a.x)
|
||||
assertEquals(65, a.foo(42))
|
||||
|
||||
assertEquals(123, B.x)
|
||||
assertEquals(265, B.foo(142))
|
||||
|
||||
assertEquals(365, foo(23))
|
||||
assertEquals(423, bar)
|
||||
|
||||
assertEquals(12345, C.f())
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+3
-1
@@ -1,6 +1,8 @@
|
||||
// MODULE_KIND: AMD
|
||||
package foo
|
||||
|
||||
@JsModule("lib") @native val foo: Int = noImpl
|
||||
@JsModule("lib")
|
||||
@native val foo: Int = noImpl
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(23, foo)
|
||||
@@ -0,0 +1,28 @@
|
||||
define("native-lib", [], function() {
|
||||
function A(x) {
|
||||
this.x = x;
|
||||
}
|
||||
A.prototype.foo = function (y) {
|
||||
return this.x + y;
|
||||
};
|
||||
|
||||
B = {
|
||||
x: 123,
|
||||
foo: function(y) {
|
||||
return this.x + y;
|
||||
}
|
||||
};
|
||||
|
||||
function foo(y) {
|
||||
return 323 + y;
|
||||
}
|
||||
|
||||
var bar = 423;
|
||||
|
||||
return {
|
||||
A: A,
|
||||
B: B,
|
||||
foo: foo,
|
||||
bar: bar
|
||||
};
|
||||
});
|
||||
@@ -0,0 +1,39 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
// MODULE_KIND: AMD
|
||||
@file:JsModule("native-lib")
|
||||
package foo
|
||||
|
||||
@native class A(@native val x: Int = noImpl) {
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
}
|
||||
|
||||
@native object B {
|
||||
@native val x: Int = noImpl
|
||||
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
}
|
||||
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
|
||||
@native val bar: Int = noImpl
|
||||
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: main.kt
|
||||
// MODULE_KIND: AMD
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val a = A(23)
|
||||
assertEquals(23, a.x)
|
||||
assertEquals(65, a.foo(42))
|
||||
|
||||
assertEquals(123, B.x)
|
||||
assertEquals(265, B.foo(142))
|
||||
|
||||
assertEquals(365, foo(23))
|
||||
assertEquals(423, bar)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
lib->
|
||||
main->lib
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
@file:JsModule("native-lib")
|
||||
package foo
|
||||
|
||||
@native class A(@native val x: Int = noImpl) {
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
}
|
||||
|
||||
@native object B {
|
||||
@native val x: Int = noImpl
|
||||
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
}
|
||||
|
||||
@native fun foo(y: Int): Int = noImpl
|
||||
|
||||
@native val bar: Int = noImpl
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val a = A(23)
|
||||
assertEquals(23, a.x)
|
||||
assertEquals(65, a.foo(42))
|
||||
|
||||
assertEquals(123, B.x)
|
||||
assertEquals(265, B.foo(142))
|
||||
|
||||
/* TODO: get rid of usages of getQualifier, then uncomment it (it's already fixed by js-name branch)
|
||||
assertEquals(365, foo(23))
|
||||
assertEquals(423, bar)*/
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user