function testPrivateGlobal(valtype, expr, result) { // Immutable private globals have a single cell for wasm.
let { get } = wasmEvalText(`(module
(global $global ${valtype} ${expr})
(func (export "get") (result ${valtype})
global.get $global
)
)`).exports;
assertEq(get(), result);
} function testExportedGlobal(valtype, expr, result) { // Immutable exported globals have a separate cell for wasm and the exported // global object.
let { global, get } = wasmEvalText(`(module
(global $global (export "global") ${valtype} ${expr})
(func (export "get") (result ${valtype})
global.get $global
)
)`).exports;
assertEq(get(), result);
assertEq(global.value, result);
} function testIndirectGlobal(valtype, expr, result) { // Mutable exported globals share an indirect cell for wasm and the exported // global object.
let { global } = wasmEvalText(`(module
(global (export "global") (mut ${valtype}) ${expr})
)`).exports;
assertEq(global.value, result);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.