JS backend: made Json::get and Json::set intrinsic.
(cherry picked from commit b1692e1)
This commit is contained in:
@@ -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")
|
||||
|
||||
+3
@@ -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 {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user