JS backend: added reviver parameter to JSON.parse.

Fixed code style in json.kt.

(cherry picked from commit b3bf97c)
This commit is contained in:
develar
2013-07-24 13:13:56 +04:00
committed by Zalim Bashorov
parent ddbea17e0f
commit 8302879991
2 changed files with 14 additions and 17 deletions
+13 -16
View File
@@ -1,33 +1,30 @@
package js package js
import java.util.*;
import js.library import js.library
native native
public class Json() { public class Json() {
library("jsonGet")
fun get(parameterName: String): Any?
library("jsonSet")
fun set(parameterName: String, value: Any?): Unit
} }
library("jsonSet") library("jsonFromTuples")
public fun Json.set(paramName : String, value : Any?) : Unit = js.noImpl public fun json(vararg pairs: Pair<String, Any?>): Json = js.noImpl
library("jsonGet") library("jsonFromTuples")
public fun Json.get(paramName : String) : Any? = js.noImpl public fun json2(pairs: Array<Pair<String, Any?>>): Json = js.noImpl
library("jsonFromPairs")
public fun json(vararg pairs : Pair<String, Any?>) : Json = js.noImpl
library("jsonFromPairs")
public fun json2(pairs : Array<Pair<String, Any?>>) : Json = js.noImpl
library("jsonAddProperties") library("jsonAddProperties")
public fun Json.add(other : Json) : Json = js.noImpl public fun Json.add(other: Json): Json = js.noImpl
native native
public trait JsonClass { public trait JsonClass {
public fun stringify(o: Any): String = noImpl public fun stringify(o: Any): String
public fun parse<T>(text: String): T = noImpl public fun parse<T>(text: String): T
public fun parse<T>(text: String, reviver: ((key: String, value: Any?)->Any?)): T
} }
native native
public val JSON:JsonClass = noImpl public val JSON: JsonClass = noImpl
+1 -1
View File
@@ -532,7 +532,7 @@ var kotlin = {set:function (receiver, key, value) {
return obj.toString(); return obj.toString();
}; };
Kotlin.jsonFromPairs = function (pairArr) { Kotlin.jsonFromTuples = function (pairArr) {
var i = pairArr.length; var i = pairArr.length;
var res = {}; var res = {};
while (i > 0) { while (i > 0) {