Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/object/__proto__-permitted-dup.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-object-initializer
5 es6id: 12.2.6
6 description: Permitted duplicate `__proto__` property
7 info: |
8 Annex B defines an early error for duplicate PropertyName of `__proto__`,
9 but this does not apply to properties created from other productions.
10
11 B.3.1 __proto__ Property Names in Object Initializers
12
13 It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains
14 any duplicate entries for "__proto__" and at least two of those entries
15 were obtained from productions of the form
16 PropertyDefinition : PropertyName : AssignmentExpression .
17 ---*/
18
19 var obj = {
20 __proto__: null,
21 __proto_: null,
22 __proto: null,
23 _proto__: null,
24 proto__: null,
25 ['__proto__']: null,
26 __proto__() {},
27 get __proto__() { return 33; },
28 set __proto__(_) { return 44; }
29 };
30
31 var desc = Object.getOwnPropertyDescriptor(obj, '__proto__');
32
33 assert.sameValue(desc.get(), 33);
34 assert.sameValue(desc.set(), 44);