aboutsummaryrefslogtreecommitdiffhomepage
path: root/targets/wasm_exec.js
diff options
context:
space:
mode:
authorElliott Sales de Andrade <[email protected]>2020-03-26 04:55:02 -0400
committerRon Evans <[email protected]>2020-04-13 08:47:34 +0200
commit471cb4cfd736a110e5b0737d8b639c37b0775166 (patch)
tree193ef19a09fec7ccd3986ec2cc5786d2f1fcb6cc /targets/wasm_exec.js
parent5706b062e9c67a74dd50e8aecfdf238cbc7c5774 (diff)
downloadtinygo-471cb4cfd736a110e5b0737d8b639c37b0775166.tar.gz
tinygo-471cb4cfd736a110e5b0737d8b639c37b0775166.zip
wasm_exec: Implement syscall/js.valueDelete.
This is only useful on Go 1.14, and is a port of: https://github.com/golang/go/commit/60f271358f07647be0de9ee8225b50a391ea5def
Diffstat (limited to 'targets/wasm_exec.js')
-rw-r--r--targets/wasm_exec.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/targets/wasm_exec.js b/targets/wasm_exec.js
index 5fe67eff7..4877cb1a4 100644
--- a/targets/wasm_exec.js
+++ b/targets/wasm_exec.js
@@ -318,6 +318,13 @@
Reflect.set(v, p, x);
},
+ // func valueDelete(v ref, p string)
+ "syscall/js.valueDelete": (v_addr, p_ptr, p_len) => {
+ const v = loadValue(v_addr);
+ const p = loadString(p_ptr, p_len);
+ Reflect.deleteProperty(v, p);
+ },
+
// func valueIndex(v ref, i int) ref
"syscall/js.valueIndex": (ret_addr, v_addr, i) => {
storeValue(ret_addr, Reflect.get(loadValue(v_addr), i));