JS backend: made Json::get and Json::set intrinsic.

(cherry picked from commit b1692e1)
This commit is contained in:
develar
2013-08-08 19:51:49 +04:00
committed by Zalim Bashorov
parent 8867c7a33f
commit 222c05dd00
3 changed files with 6 additions and 16 deletions
+3 -6
View File
@@ -2,12 +2,9 @@ package js
import js.library
native
public class Json() {
library("jsonGet")
fun get(parameterName: String): Any?
library("jsonSet")
fun set(parameterName: String, value: Any?): Unit
native public class Json() {
fun get(propertyName: String): Any? = js.noImpl
fun set(propertyName: String, value: Any?): Unit = js.noImpl
}
library("jsonFromTuples")
@@ -165,6 +165,9 @@ public final class TopLevelFIF extends CompositeFIF {
String[] javaUtil = {"java", "util"};
add(pattern(javaUtil, "HashMap", "<init>"), new MapSelectImplementationIntrinsic(false));
add(pattern(javaUtil, "HashSet", "<init>"), new MapSelectImplementationIntrinsic(true));
add(pattern("js", "Json", "get"), ArrayFIF.GET_INTRINSIC);
add(pattern("js", "Json", "set"), ArrayFIF.SET_INTRINSIC);
}
private abstract static class NativeMapGetSet extends CallParametersAwareFunctionIntrinsic {
-10
View File
@@ -555,16 +555,6 @@ String.prototype.contains = function (s) {
return res;
};
//TODO: use intrinsic
Kotlin.jsonSet = function (obj, attrName, value) {
obj[attrName] = value;
};
Kotlin.jsonGet = function (obj, attrName) {
return obj[attrName];
};
Kotlin.jsonAddProperties = function (obj1, obj2) {
for (var p in obj2) {
if (obj2.hasOwnProperty(p)) {