@webassemblyjs/helper-module-context
Advanced tools
Comparing version 1.7.4 to 1.7.5
@@ -39,3 +39,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
{ | ||
moduleContext.importGlobal(field.descr.valtype); | ||
moduleContext.importGlobal(field.descr.valtype, field.descr.mutability); | ||
break; | ||
@@ -169,3 +169,3 @@ } | ||
}); | ||
this.funcs.unshift({ | ||
this.funcs.push({ | ||
args: args, | ||
@@ -275,3 +275,3 @@ result: result | ||
var type = global.globalType.valtype; | ||
var mutability = global.mutability; | ||
var mutability = global.globalType.mutability; | ||
this.globals.push({ | ||
@@ -289,3 +289,3 @@ type: type, | ||
value: function importGlobal(type, mutability) { | ||
this.globals.unshift({ | ||
this.globals.push({ | ||
type: type, | ||
@@ -300,2 +300,7 @@ mutability: mutability | ||
} | ||
}, { | ||
key: "isImmutableGlobal", | ||
value: function isImmutableGlobal(index) { | ||
return this.globals[index].mutability === "const"; | ||
} | ||
/** | ||
@@ -302,0 +307,0 @@ * Memories |
@@ -47,3 +47,3 @@ "use strict"; | ||
{ | ||
moduleContext.importGlobal(field.descr.valtype); | ||
moduleContext.importGlobal(field.descr.valtype, field.descr.mutability); | ||
break; | ||
@@ -178,3 +178,3 @@ } | ||
}); | ||
this.funcs.unshift({ | ||
this.funcs.push({ | ||
args: args, | ||
@@ -284,3 +284,3 @@ result: result | ||
var type = global.globalType.valtype; | ||
var mutability = global.mutability; | ||
var mutability = global.globalType.mutability; | ||
this.globals.push({ | ||
@@ -298,3 +298,3 @@ type: type, | ||
value: function importGlobal(type, mutability) { | ||
this.globals.unshift({ | ||
this.globals.push({ | ||
type: type, | ||
@@ -309,2 +309,7 @@ mutability: mutability | ||
} | ||
}, { | ||
key: "isImmutableGlobal", | ||
value: function isImmutableGlobal(index) { | ||
return this.globals[index].mutability === "const"; | ||
} | ||
/** | ||
@@ -311,0 +316,0 @@ * Memories |
{ | ||
"name": "@webassemblyjs/helper-module-context", | ||
"version": "1.7.4", | ||
"version": "1.7.5", | ||
"description": "", | ||
@@ -18,3 +18,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@webassemblyjs/wast-parser": "1.7.4" | ||
"@webassemblyjs/wast-parser": "1.7.5" | ||
}, | ||
@@ -21,0 +21,0 @@ "publishConfig": { |
@@ -26,3 +26,6 @@ // TODO(sven): add flow in here | ||
case "GlobalType": { | ||
moduleContext.importGlobal(field.descr.valtype); | ||
moduleContext.importGlobal( | ||
field.descr.valtype, | ||
field.descr.mutability | ||
); | ||
break; | ||
@@ -133,3 +136,3 @@ } | ||
this.funcs.unshift({ args, result }); | ||
this.funcs.push({ args, result }); | ||
@@ -213,3 +216,3 @@ if (typeof funcimport.id !== "undefined") { | ||
const type = global.globalType.valtype; | ||
const mutability = global.mutability; | ||
const mutability = global.globalType.mutability; | ||
@@ -225,3 +228,3 @@ this.globals.push({ type, mutability }); | ||
importGlobal(type, mutability) { | ||
this.globals.unshift({ type, mutability }); | ||
this.globals.push({ type, mutability }); | ||
} | ||
@@ -233,2 +236,6 @@ | ||
isImmutableGlobal(index) { | ||
return this.globals[index].mutability === "const"; | ||
} | ||
/** | ||
@@ -235,0 +242,0 @@ * Memories |
23008
819