Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix computed property methods can call super methods (#2274)
<!--- Thank you for contributing to Boa! Please fill out the template below, and remove or add any information as you feel neccesary. ---> This Pull Request fixes: https://github.com/tc39/test262/blob/79e3bc5176b6f29a5aed3b7164a9c623a3a9a63b/test/language/computed-property-names/object/method/super.js This PR solves the bug of using the `super` keyword in the method attribute of object. When the environment is `None`, the `vm` gets the top element of `vm.stack` as `this`, such as: ```js var a = { f() { return super.m(); } }; var b = { m() { retrun "super"; } }; Object.setPrototypeOf(a, b); a.f(); // the top of stack is `a` let f = a.f; f(); // the top of stack is `global_this`, so `super` cannot be used ``` ### Can be improved What I think is that when I use `object.method()`, the engine should bind `this_object` to the `environment`, instead of using `vm.stack.last()...`. ### TODOS 1. `super` need to look for properties all the way to the end. Co-authored-by: creampnx_x <[email protected]>
- Loading branch information