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

fix: Use Object.getPrototypeOf to get prototype in __proto__-fn-name.js #4205

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions test/language/expressions/object/__proto__-fn-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@
// This code is governed by the BSD license found in the LICENSE file.

/*---
es6id: B.3.1
description: Function name is not assigned based on the property name
esid: sec-runtime-semantics-propertydefinitionevaluation
description: Function name is not assigned based on the __proto__ property name
info: |
[...]
6. If propKey is the String value "__proto__" and if
IsComputedPropertyKey(propKey) is false, then
a. If Type(propValue) is either Object or Null, then
i. Return object.[[SetPrototypeOf]](propValue).
b. Return NormalCompletion(empty).
7. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
a. Let hasNameProperty be HasOwnProperty(propValue, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(propValue, propKey).
3. Else if propKey is "__proto__" and IsComputedPropertyKey of PropertyName is false, then
a. Let isProtoSetter be true.
[...]
5. If IsAnonymousFunctionDefinition(AssignmentExpression) is true and isProtoSetter is false, then
a. Let propValue be ? NamedEvaluation of AssignmentExpression with argument propKey.
6. Else,
a. Let exprValueRef be ? Evaluation of AssignmentExpression.
---*/

var o;

o = {
__proto__: function() {}
__proto__: function () {},
};

assert(o.__proto__.name !== '__proto__');
assert(Object.getPrototypeOf(o).name !== "__proto__");
Loading