Skip to content

An issue about the arguments object #374

@NWU-NISL

Description

@NWU-NISL

Description

According to Ecma262 specification, When changing the arguments exotic object's property, it will change the corresponding value of the argument binding at the same time. But when I executed the following test case, Hermes doesn't use the arguments object to change the argument correctly. I think it may be a bug of the Hermes engine.

Version

b6530ae(release)

Testcase

function f0(args){
    var v0 = 0;
    for (var v1 = 0; v1 < args.length; ++v1){
        v0 += args[v1];
        args[v1] += v1;
    }
    return v0;
}

function f1(a, b, c, d){
    return [
        f0(arguments),
        a,
        b,
        c,
        d
    ];
}

print(f1(0,1,2,3));

Command

./build/bin/hermes -w testcase.js

Output

6,0,1,2,3

Expected Output

6,0,2,4,6

Ecma262 Specification

9.4.4 Arguments Exotic Objects

NOTE 2 ……This means that changing the property changes the corresponding value of the argument binding and vice-versa. ……

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    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