Skip to content

Calling binaryen.getExpressionInfo(exprRef) with an unreachable function body throws #106

@fallow64

Description

@fallow64

Calling binaryen.getExpressionInfo(exprRef) with the reference of the body where it's only instruction is unreachable causes the following JS error:

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at A.getExpressionInfo (file:///Users/austin/dev/fallow64-binaryen-js-issue-example/node_modules/binaryen/index.js:8:4495)
    at main (/Users/austin/dev/fallow64-binaryen-js-issue-example/src/main.ts:28:38)
    at /Users/austin/dev/fallow64-binaryen-js-issue-example/src/main.ts:34:1
    at async Function.import (/Users/austin/dev/fallow64-binaryen-js-issue-example/node_modules/jiti/dist/jiti.cjs:1:202945)
    at async file:///Users/austin/dev/fallow64-binaryen-js-issue-example/node_modules/jiti/lib/jiti-cli.mjs:31:1

I'm unfamiliar with the codebase so I'm not too sure if it's the expression information resolving that's causing the issue, the function parser, or something else. Seems to be a regression due to 1.124.0. Changing the dependency in package.json of the example to ^123.0.0 resolves the issue.

Example repo: https://github.com/fallow64/fallow64-binaryen-js-issue-example

Tested platforms: MacOS, Windows

Thanks :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions