Skip to content

Generated code tries to read from undefined? #14

@Heath123

Description

@Heath123

Starting with this:

print('Hello World');

and running:

$ hermes -emit-binary -out bin.hbc -O0 in.js
$ hbc-decompiler bin.hbc out.js

gives the following:

r0 = undefined;
r1 = global;
r2 = 'Hello World';
r3 = r0;
r4 = r1.print;
r9 = r0;
r8 = r2;
r5 = r9[r4](r8, r7);
r3 = r5;
r6 = r3;
return r6;

r0 is set to undefined, then r9 is set to r0, then the line r5 = r9[r4](r8, r7); tries to read a property from undefined? Why is it doing this? Also, the property it's reading is the function object that it's supposed to be calling??? I don't get what is supposed to be happening here

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