KJS: don't overwrite prototype of native classes when inheriting from them

This commit is contained in:
Zalim Bashorov
2016-11-14 19:40:04 +03:00
parent c25dfe997c
commit bd90b4e051
3 changed files with 53 additions and 1 deletions
@@ -0,0 +1,45 @@
// FILE: nativeNativeKotlin.kt
package foo
@native
open class A {
fun foo(): String
}
@native
open class B : A() {
fun bar(): String
}
class C : B()
fun box(): String {
val c = C()
assertEquals("A.foo", c.foo())
assertEquals("B.bar", c.bar())
return "OK"
}
// FILE: nativeNativeKotlin.js
function A() {
}
A.prototype.foo = function () {
return "A.foo"
};
function B() {
}
B.prototype = Object.create(A.prototype);
B.prototype.constructor = B;
B.prototype.bar = function () {
return "B.bar"
};