summaryrefslogtreecommitdiff
path: root/src/js
diff options
context:
space:
mode:
authorDaniel Wirtz <dcode@dcode.io>2017-11-15 18:55:50 +0100
committerAlon Zakai <alonzakai@gmail.com>2017-11-15 09:55:50 -0800
commitdc0cd445c08ede80fa2b1747cffcd2254c97a0f6 (patch)
treedea167a459ceab94c64aa947eae7a2c90db12552 /src/js
parent4deed1eb310993391fa0e7e06a18cf2303674f98 (diff)
downloadbinaryen-dc0cd445c08ede80fa2b1747cffcd2254c97a0f6.tar.gz
binaryen-dc0cd445c08ede80fa2b1747cffcd2254c97a0f6.tar.bz2
binaryen-dc0cd445c08ede80fa2b1747cffcd2254c97a0f6.zip
Add const expression utilities to binaryen-c/.js (#1288)
Diffstat (limited to 'src/js')
-rw-r--r--src/js/binaryen.js-post.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index a29a035c6..352da1c0a 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -1111,6 +1111,25 @@
return Module['_BinaryenExpressionGetType'](expr);
};
+ Module['getConstValueI32'] = function(expr) {
+ return Module['_BinaryenConstGetValueI32'](expr);
+ };
+
+ Module['getConstValueI64'] = function(expr) {
+ return {
+ 'low': Module['_BinaryenConstGetValueI64Low'](expr),
+ 'high': Module['_BinaryenConstGetValueI64High'](expr)
+ };
+ };
+
+ Module['getConstValueF32'] = function(expr) {
+ return Module['_BinaryenConstGetValueF32'](expr);
+ };
+
+ Module['getConstValueF64'] = function(expr) {
+ return Module['_BinaryenConstGetValueF64'](expr);
+ };
+
// emit text of an expression or a module
Module['emitText'] = function(expr) {
if (typeof expr === 'object') {