Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling to getter/setter method incorrectly #775

Closed
NWU-NISL opened this issue Oct 2, 2020 · 0 comments · Fixed by #908
Closed

Calling to getter/setter method incorrectly #775

NWU-NISL opened this issue Oct 2, 2020 · 0 comments · Fixed by #908

Comments

@NWU-NISL
Copy link

NWU-NISL commented Oct 2, 2020

Description

As the following test case shown, when I get the attribute 2 of the object v0 in the tenth line, Rhino returns the setter method instead of calling the getter method. According to ECMA262, getter method should be called here, so v0[2] should return 1 instead of the setter method.

Version

1.7.13

Command

java -jar  rhino/rhino-1.7.13.jar -debug -version 200 testcase.js

testcase

function f() {
    var v0 = {
        get 2(){
            return 1;
        },
        set 2(value){
            throw new Error(2);
        }
    }
    var v1 = v0[2];
    print(v1);
}
f()

Output

function (value) {
    throw new Error(2);
}

Expected output

1

contributor:@QuXing9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant