KT-2752: fix JsName with explicit use target. Add some tests for JsName with use targets
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
function A() {
|
||||
this.y_ = 0;
|
||||
}
|
||||
A.prototype.getX = function() {
|
||||
return 23;
|
||||
};
|
||||
A.prototype.getY = function() {
|
||||
return this.y_;
|
||||
};
|
||||
A.prototype.setY = function(y) {
|
||||
return this.y_ = y;
|
||||
};
|
||||
|
||||
var z_ = 32;
|
||||
function getZ() {
|
||||
return z_;
|
||||
}
|
||||
function setZ(z) {
|
||||
z_ = z;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package foo
|
||||
|
||||
@native class A {
|
||||
val xx: Int
|
||||
@JsName("getX") get
|
||||
|
||||
var yy: Int
|
||||
@JsName("getY") get
|
||||
@JsName("setY") set
|
||||
}
|
||||
|
||||
@native var zz: Int
|
||||
@JsName("getZ") get
|
||||
@JsName("setZ") set
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
|
||||
assertEquals(23, a.xx)
|
||||
assertEquals(0, a.yy)
|
||||
a.yy = 42
|
||||
assertEquals(42, a.yy)
|
||||
|
||||
assertEquals(32, zz)
|
||||
zz = 232
|
||||
assertEquals(232, zz)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user