JS backend: cleanup strings code.

Added String.size and String.length().
This commit is contained in:
develar
2013-08-06 17:24:48 +04:00
committed by Zalim Bashorov
parent 678f6601dd
commit 7c18ab3ca8
9 changed files with 37 additions and 79 deletions
@@ -0,0 +1,6 @@
package foo
fun box(): Boolean {
val s = "bar"
return s.size == 3 && s.length() == 3 && s.length == 3
}
@@ -1,6 +1,6 @@
package foo
val String.size : Int
val String.prop : Int
get() = length
val Int.quadruple : Int
@@ -8,9 +8,9 @@ val Int.quadruple : Int
fun box() : Boolean
{
if ("1".size != 1) return false;
if ("11".size != 2) return false;
if (("121" + "123").size != 6) return false;
if ("1".prop != 1) return false;
if ("11".prop != 2) return false;
if (("121" + "123").prop != 6) return false;
if (1.quadruple != 4) return false;
if (0.quadruple != 0) return false;
return true;
@@ -4,7 +4,6 @@
*/
import java.util.*
import java.lang.split;
import js.*;
/*