@webassemblyjs/helper-module-context
Advanced tools
Comparing version 1.8.0 to 1.8.1
@@ -20,4 +20,11 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
moduleContext.setStart(field.index); | ||
break; | ||
} | ||
case "TypeInstruction": | ||
{ | ||
moduleContext.addType(field); | ||
break; | ||
} | ||
case "Func": | ||
@@ -90,2 +97,3 @@ { | ||
this.funcsOffsetByIdentifier = []; | ||
this.types = []; | ||
this.globals = []; | ||
@@ -247,2 +255,25 @@ this.globalsOffsetByIdentifier = []; | ||
/** | ||
* Types | ||
*/ | ||
}, { | ||
key: "addType", | ||
value: function addType(type) { | ||
if (!(type.functype.type === "Signature")) { | ||
throw new Error('type.functype.type === "Signature"' + " error: " + (undefined || "unknown")); | ||
} | ||
this.types.push(type.functype); | ||
} | ||
}, { | ||
key: "hasType", | ||
value: function hasType(index) { | ||
return this.types[index] !== undefined; | ||
} | ||
}, { | ||
key: "getType", | ||
value: function getType(index) { | ||
return this.types[index]; | ||
} | ||
/** | ||
* Globals | ||
@@ -249,0 +280,0 @@ */ |
@@ -28,4 +28,11 @@ "use strict"; | ||
moduleContext.setStart(field.index); | ||
break; | ||
} | ||
case "TypeInstruction": | ||
{ | ||
moduleContext.addType(field); | ||
break; | ||
} | ||
case "Func": | ||
@@ -99,2 +106,3 @@ { | ||
this.funcsOffsetByIdentifier = []; | ||
this.types = []; | ||
this.globals = []; | ||
@@ -256,2 +264,25 @@ this.globalsOffsetByIdentifier = []; | ||
/** | ||
* Types | ||
*/ | ||
}, { | ||
key: "addType", | ||
value: function addType(type) { | ||
if (!(type.functype.type === "Signature")) { | ||
throw new Error('type.functype.type === "Signature"' + " error: " + (undefined || "unknown")); | ||
} | ||
this.types.push(type.functype); | ||
} | ||
}, { | ||
key: "hasType", | ||
value: function hasType(index) { | ||
return this.types[index] !== undefined; | ||
} | ||
}, { | ||
key: "getType", | ||
value: function getType(index) { | ||
return this.types[index]; | ||
} | ||
/** | ||
* Globals | ||
@@ -258,0 +289,0 @@ */ |
{ | ||
"name": "@webassemblyjs/helper-module-context", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "", | ||
@@ -15,3 +15,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@webassemblyjs/wast-parser": "1.8.0", | ||
"@webassemblyjs/wast-parser": "1.8.1", | ||
"mamacro": "^0.0.3" | ||
@@ -24,3 +24,3 @@ }, | ||
"license": "MIT", | ||
"gitHead": "8b2d1afa793ea81f20ec63416134c201e39694eb" | ||
"gitHead": "a2f42245e9b597e3541e0f697253449d60fc4d79" | ||
} |
@@ -14,3 +14,8 @@ // TODO(sven): add flow in here | ||
moduleContext.setStart(field.index); | ||
break; | ||
} | ||
case "TypeInstruction": { | ||
moduleContext.addType(field); | ||
break; | ||
} | ||
case "Func": { | ||
@@ -76,2 +81,4 @@ moduleContext.addFunction(field); | ||
this.types = []; | ||
this.globals = []; | ||
@@ -198,2 +205,18 @@ this.globalsOffsetByIdentifier = []; | ||
/** | ||
* Types | ||
*/ | ||
addType(type) { | ||
assert(type.functype.type === "Signature"); | ||
this.types.push(type.functype); | ||
} | ||
hasType(index) { | ||
return this.types[index] !== undefined; | ||
} | ||
getType(index) { | ||
return this.types[index]; | ||
} | ||
/** | ||
* Globals | ||
@@ -200,0 +223,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25839
894