diff --git a/js/js.libraries/src/core/javautil.kt b/js/js.libraries/src/core/javautil.kt index e3973c3a37e..ab3f03808e9 100644 --- a/js/js.libraries/src/core/javautil.kt +++ b/js/js.libraries/src/core/javautil.kt @@ -41,6 +41,7 @@ public open class ArrayList() : java.util.List { public override fun set(index : Int, element : E) : E = js.noImpl public override fun add(e : E) : Boolean = js.noImpl public override fun add(index : Int, element : E) : Unit = js.noImpl + library("removeByIndex") public override fun remove(index : Int) : E = js.noImpl public override fun remove(o : Any?) : Boolean = js.noImpl public override fun clear() : Unit = js.noImpl diff --git a/js/js.libraries/src/html5/canvas.kt b/js/js.libraries/src/html5/canvas.kt index ad3aab58cd3..2c4d4838407 100644 --- a/js/js.libraries/src/html5/canvas.kt +++ b/js/js.libraries/src/html5/canvas.kt @@ -11,17 +11,12 @@ class Context() { fun scale(x : Double, y : Double) : Unit = js.noImpl - fun rotate(angle : Double) : Unit = js.noImpl - fun translate(x : Double, y : Double) : Unit = js.noImpl - - - fun clearRect(x : Double, y : Double, w : Double, h : Double) : Unit = js.noImpl - - fun fillRect(x : Double, y : Double, w : Double, h : Double) : Unit = js.noImpl - - fun strokeRect(x : Double, y : Double, w : Double, h : Double) : Unit = js.noImpl + fun translate(x : Int, y : Int) : Unit = js.noImpl + fun clearRect(x : Int, y : Int, w : Int, h : Int) : Unit = js.noImpl + fun fillRect(x : Int, y : Int, w : Int, h : Int) : Unit = js.noImpl + fun strokeRect(x : Int, y : Int, w : Int, h : Int) : Unit = js.noImpl var globalAlpha : Double = 1.0; @@ -35,37 +30,29 @@ class Context() { var font : String = "" fun beginPath() : Unit = js.noImpl - - fun moveTo(x : Double, y : Double) : Unit = js.noImpl - fun closePath() : Unit = js.noImpl - - fun lineTo(x : Double, y : Double) : Unit = js.noImpl + fun moveTo(x : Int, y : Int) : Unit = js.noImpl + fun lineTo(x : Int, y : Int) : Unit = js.noImpl fun quadraticCurveTo(cpx : Double, cpy : Double, x : Double, y : Double) : Unit = js.noImpl - fun bezierCurveTo(cp1x : Double, cp1y : Double, cp2x : Double, cp2y : Double, x : Double, y : Double) : Unit = js.noImpl - fun arcTo(x1 : Double, y1 : Double, x2 : Double, y2 : Double, radius : Double) : Unit = js.noImpl fun arc(x : Double, y : Double, radius : Double, startAngle : Double, endAngle : Double, anticlockwise : Boolean) : Unit = js.noImpl - fun rect(x : Double, y : Double, w : Double, h : Double) : Unit = js.noImpl + fun rect(x : Int, y : Int, w : Int, h : Int) : Unit = js.noImpl fun fill() : Unit = js.noImpl fun stroke() : Unit = js.noImpl - fun fillText(text : String, x : Double, y : Double) : Unit = js.noImpl - - fun fillText(text : String, x : Double, y : Double, maxWidth : Double) : Unit = js.noImpl - - fun strokeText(text : String, x : Double, y : Double) : Unit = js.noImpl - - fun strokeText(text : String, x : Double, y : Double, maxWidth : Double) : Unit = js.noImpl + fun fillText(text : String, x : Int, y : Int) : Unit = js.noImpl + fun fillText(text : String, x : Int, y : Int, maxWidth : Int) : Unit = js.noImpl + fun strokeText(text : String, x : Int, y : Int) : Unit = js.noImpl + fun strokeText(text : String, x : Int, y : Int, maxWidth : Int) : Unit = js.noImpl fun measureText(text : String) : TextMetrics = TextMetrics(); @@ -73,7 +60,7 @@ class Context() { fun drawImage(image : HTMLImageElement, dx : Int, dy : Int) : Unit = js.noImpl fun drawImage(image : HTMLImageElement, dx : Int, dy : Int, dw : Int, dh : Int) : Unit = js.noImpl fun drawImage(image : HTMLImageElement, sx : Int, sy : Int, - sw : Int, sh : Int, dx : Int, dy : Int, dw : Int, dh : Int) : Unit = js.noImpl + sw : Int, sh : Int, dx : Int, dy : Int, dw : Int, dh : Int) : Unit = js.noImpl fun createLinearGradient(x0 : Double, y0 : Double, x1 : Double, y1 : Double) : CanvasGradient = CanvasGradient() diff --git a/js/js.translator/testFiles/kotlin_lib.js b/js/js.translator/testFiles/kotlin_lib.js index 07e456d794f..67bb8310ef1 100644 --- a/js/js.translator/testFiles/kotlin_lib.js +++ b/js/js.translator/testFiles/kotlin_lib.js @@ -324,7 +324,15 @@ var Kotlin; this.add(it.next()); } }, - remove:function (index) { + remove:function(value) { + for (var i = 0; i < this.$size; ++i) { + if (this.array[i] == value) { + this.removeByIndex(i); + return; + } + } + }, + removeByIndex:function (index) { for (var i = index; i < this.$size - 1; ++i) { this.array[i] = this.array[i + 1]; } @@ -403,16 +411,16 @@ var Kotlin; Kotlin.System.out().print(s); }; - Kotlin.AbstractFunctionInvokationError = Class.create(); + Kotlin.AbstractFunctionInvocationError = Class.create(); Kotlin.Iterator = Class.create({ initialize:function () { }, next:function () { - throw new Kotlin.AbstractFunctionInvokationError(); + throw new Kotlin.AbstractFunctionInvocationError(); }, hasNext:function () { - throw new Kotlin.AbstractFunctionInvokationError(); + throw new Kotlin.AbstractFunctionInvocationError(); } }); @@ -496,7 +504,7 @@ var Kotlin; initialize:function () { }, compare:function (el1, el2) { - throw new Kotlin.AbstractFunctionInvokationError(); + throw new Kotlin.AbstractFunctionInvocationError(); } } );