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
import java.util.*;
import js.library
native
public class Json() {
library("jsonGet")
fun get(parameterName: String): Any?
library("jsonSet")
fun set(parameterName: String, value: Any?): Unit
}
library("jsonSet")
public fun Json.set(paramName : String, value : Any?) : Unit = js.noImpl
library("jsonFromTuples")
public fun json(vararg pairs: Pair<String, Any?>): Json = js.noImpl
library("jsonGet")
public fun Json.get(paramName : String) : Any? = 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("jsonFromTuples")
public fun json2(pairs: Array<Pair<String, Any?>>): Json = js.noImpl
library("jsonAddProperties")
public fun Json.add(other : Json) : Json = js.noImpl
public fun Json.add(other: Json): Json = js.noImpl
native
public trait JsonClass {
public fun stringify(o: Any): String = noImpl
public fun parse<T>(text: String): T = noImpl
public fun stringify(o: Any): String
public fun parse<T>(text: String): T
public fun parse<T>(text: String, reviver: ((key: String, value: Any?)->Any?)): T
}
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();
};
Kotlin.jsonFromPairs = function (pairArr) {
Kotlin.jsonFromTuples = function (pairArr) {
var i = pairArr.length;
var res = {};
while (i > 0) {