Skip to content

Commit afd82ab

Browse files
committed
Shorter global
1 parent 7c49260 commit afd82ab

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/compile.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,7 @@ const build = [,
339339
(node, ctx) => limits(node),
340340

341341
// (global $id? (mut i32) (i32.const 42))
342-
(node, ctx) => {
343-
let [t] = node, mut = t[0] === 'mut' ? 1 : 0
344-
345-
let [, init] = node
346-
return ([...type(mut ? t[1] : t, ctx), mut, ...expr(init, ctx)])
347-
},
342+
([t, init], ctx) => [...fieldtype(t, ctx), ...expr(init, ctx)],
348343

349344
// (export "name" (func|table|mem $name|idx))
350345
([nm, [kind, l]], ctx) => ([...vec(str(nm.slice(1, -1))), KIND[kind], ...uleb(id(l, ctx[kind]))]),

0 commit comments

Comments
 (0)