Skip to content

Comments on wasm-module-builder.js #897

@Ms2ger

Description

@Ms2ger

In https://bugzilla.mozilla.org/show_bug.cgi?id=1500442, @bnjbvr suggests:

::: testing/web-platform/tests/wasm/jsapi/wasm-module-builder.js
@@ +134,5 @@
> +  }
> +
> +  addLocals(locals, names) {
> +    const old_num_locals = this.getNumLocals();
> +    if (!this.locals) this.locals = []

Wouldn't it be better to have this.locals = [] in the ctor?

@@ +137,5 @@
> +    const old_num_locals = this.getNumLocals();
> +    if (!this.locals) this.locals = []
> +    this.locals.push(locals);
> +    if (names) {
> +      if (!this.local_names) this.local_names = [];

ditto

@@ +243,5 @@
>                         type: type_index});
>      return this.num_imported_funcs++;
>    }
>  
> +  addImportedGlobal(module = "", name, type, mutable = false) {

Uh, mixing optional params with non-optional always makes me a bit nervous...

Maybe @hammacher would like to respond or address the comments in the V8 repo?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions