v8/test/mjsunit/object-literal-multiple-proto-fields.js
arv b004b1d821 Move object literal checking into checker classes
This removes the duplicate property check from object literals.

Instead we repurpose the ObjectLiteralChecker into two cases, implemented
by two subclasses to ObjectLiteralCheckerBase called ObjectLiteralChecker
and ClassLiteralChecker.

The object literal checker now only checks for duplicate __proto__ fields in
object literals.

The class literal checker checks for duplicate constructors, non constructor
fields named constructor as well as static properties named prototype.

BUG=v8:3819
LOG=Y
R=adamk, dslomov@chromium.org

Review URL: https://codereview.chromium.org/873823003

Cr-Commit-Position: refs/heads/master@{#26336}
2015-01-29 23:12:43 +00:00

22 lines
478 B
JavaScript

// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var p1 = {};
var p2 = {};
var p3 = {};
var x = 0;
var y = 1;
var z = 2;
var o = 3;
assertThrows(
'o = {' +
' __proto__: (x++, p1),' +
' __proto__: (y++, p2),' +
' __proto__: (z++, p3)' +
'};', SyntaxError);
assertEquals(0, x);
assertEquals(1, y);
assertEquals(2, z);
assertEquals(3, o);