summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/object/__proto__-permitted-dup-shorthand.js
blob: e22f33e83e3420c0b87b1edad9e72f601431b382 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-object-initializer
description: Permitted duplicate `__proto__` property (shorthand)
info: |
    Annex B defines an early error for duplicate PropertyName of `__proto__`,
    but this does not apply to properties created from other productions.

    B.3.1 __proto__ Property Names in Object Initializers

    It is a Syntax Error if PropertyNameList of PropertyDefinitionList contains
    any duplicate entries for "__proto__" and at least two of those entries
    were obtained from productions of the form
    PropertyDefinition : PropertyName : AssignmentExpression .
---*/

var __proto__ = 2;
var obj = {
  __proto__,
  __proto__,
};

assert(obj.hasOwnProperty("__proto__"));
assert.sameValue(obj.__proto__, 2);

reportCompare(0, 0);