JS: Make js Error to be mapped to kotlin.Throwable, inherit Exception and Error from Throwable.

This commit is contained in:
Ilya Gorbunov
2015-07-17 15:05:04 +03:00
parent f2716a973c
commit b7829d8471
3 changed files with 12 additions and 4 deletions
+3
View File
@@ -1,5 +1,8 @@
package java.lang package java.lang
library
open public class Error(message: String? = null): Throwable(message) {}
library library
open public class Exception(message: String? = null): Throwable(message) {} open public class Exception(message: String? = null): Throwable(message) {}
@@ -121,6 +121,8 @@ public final class StandardClasses {
standardClasses.declare().forFQ("kotlin.Enum").kotlinClass("Enum"); standardClasses.declare().forFQ("kotlin.Enum").kotlinClass("Enum");
standardClasses.declare().forFQ("kotlin.Comparable").kotlinClass("Comparable"); standardClasses.declare().forFQ("kotlin.Comparable").kotlinClass("Comparable");
standardClasses.declare().forFQ("koltin.Throwable").kotlinClass("Throwable");
} }
+7 -4
View File
@@ -178,7 +178,8 @@
return new Kotlin.Progression(from, to, -1); return new Kotlin.Progression(from, to, -1);
}; };
Kotlin.Exception = Error; Kotlin.Throwable = Error;
function createClassNowWithMessage(base) { function createClassNowWithMessage(base) {
return Kotlin.createClassNow(base, return Kotlin.createClassNow(base,
@@ -189,6 +190,8 @@
); );
} }
Kotlin.Error = createClassNowWithMessage(Kotlin.Throwable);
Kotlin.Exception = createClassNowWithMessage(Kotlin.Throwable);
Kotlin.RuntimeException = createClassNowWithMessage(Kotlin.Exception); Kotlin.RuntimeException = createClassNowWithMessage(Kotlin.Exception);
Kotlin.NullPointerException = createClassNowWithMessage(Kotlin.RuntimeException); Kotlin.NullPointerException = createClassNowWithMessage(Kotlin.RuntimeException);
Kotlin.NoSuchElementException = createClassNowWithMessage(Kotlin.RuntimeException); Kotlin.NoSuchElementException = createClassNowWithMessage(Kotlin.RuntimeException);
@@ -386,7 +389,7 @@
}, },
clear: function () { clear: function () {
// TODO: implement with mutable iterator // TODO: implement with mutable iterator
throw new Kotlin.UnsupportedOperationException("Not implemented yet, see KT-7809"); throw new Kotlin.NotImplementedError("Not implemented yet, see KT-7809");
}, },
containsAll_4fm7v2$: function (c) { containsAll_4fm7v2$: function (c) {
var it = c.iterator(); var it = c.iterator();
@@ -464,7 +467,7 @@
}, },
addAll_9cca64$: function (index, collection) { addAll_9cca64$: function (index, collection) {
// TODO: implement // TODO: implement
throw new Kotlin.UnsupportedOperationException("Not implemented yet, see KT-7809"); throw new Kotlin.NotImplementedError("Not implemented yet, see KT-7809");
}, },
remove_za3rmp$: function (o) { remove_za3rmp$: function (o) {
var index = this.indexOf_za3rmp$(o); var index = this.indexOf_za3rmp$(o);
@@ -476,7 +479,7 @@
}, },
clear: function () { clear: function () {
// TODO: implement with remove range // TODO: implement with remove range
throw new Kotlin.UnsupportedOperationException("Not implemented yet, see KT-7809"); throw new Kotlin.NotImplementedError("Not implemented yet, see KT-7809");
}, },
contains_za3rmp$: function (o) { contains_za3rmp$: function (o) {
return this.indexOf_za3rmp$(o) !== -1; return this.indexOf_za3rmp$(o) !== -1;