Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit da1e907

Browse files
Handle negative type codes in wasm-module-builder.js (#335)
1 parent 6ca3310 commit da1e907

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/js-api/wasm-module-builder.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ class WasmModuleBuilder {
981981
section.emit_u32v(imp.initial); // initial
982982
if (has_max) section.emit_u32v(imp.maximum); // maximum
983983
} else if (imp.kind == kExternalTable) {
984-
section.emit_u8(imp.type);
984+
section.emit_type(imp.type);
985985
var has_max = (typeof imp.maximum) != "undefined";
986986
section.emit_u8(has_max ? 1 : 0); // flags
987987
section.emit_u32v(imp.initial); // initial
@@ -1013,7 +1013,7 @@ class WasmModuleBuilder {
10131013
binary.emit_section(kTableSectionCode, section => {
10141014
section.emit_u32v(wasm.tables.length);
10151015
for (let table of wasm.tables) {
1016-
section.emit_u8(table.type);
1016+
section.emit_type(table.type);
10171017
section.emit_u8(table.has_max);
10181018
section.emit_u32v(table.initial_size);
10191019
if (table.has_max) section.emit_u32v(table.max_size);
@@ -1045,7 +1045,7 @@ class WasmModuleBuilder {
10451045
binary.emit_section(kGlobalSectionCode, section => {
10461046
section.emit_u32v(wasm.globals.length);
10471047
for (let global of wasm.globals) {
1048-
section.emit_u8(global.type);
1048+
section.emit_type(global.type);
10491049
section.emit_u8(global.mutable);
10501050
if ((typeof global.init_index) == "undefined") {
10511051
// Emit a constant initializer.
@@ -1219,7 +1219,7 @@ class WasmModuleBuilder {
12191219
header.emit_u32v(local_decls.length);
12201220
for (let decl of local_decls) {
12211221
header.emit_u32v(decl.count);
1222-
header.emit_u8(decl.type);
1222+
header.emit_type(decl.type);
12231223
}
12241224

12251225
section.emit_u32v(header.length + func.body.length);

0 commit comments

Comments
 (0)