64abe65210
We incorrectly disallowed eval and arguments in accessor and method names. This was because we checked the name inside the ParseFunctionLiteral. We now flag accessors so that lazy parsing of these functions are treated correctly. BUG=v8:1984 R=adamk, dslomov@chromium.org LOG=N Review URL: https://codereview.chromium.org/899363002 Cr-Commit-Position: refs/heads/master@{#26497}
36 lines
609 B
JavaScript
36 lines
609 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.
|
|
|
|
// Flags: --harmony-object-literals
|
|
|
|
(function TestSloppyMode() {
|
|
var o = {
|
|
eval() {
|
|
return 1;
|
|
},
|
|
arguments() {
|
|
return 2;
|
|
},
|
|
};
|
|
|
|
assertEquals(1, o.eval());
|
|
assertEquals(2, o.arguments());
|
|
})();
|
|
|
|
(function TestStrictMode() {
|
|
'use strict';
|
|
|
|
var o = {
|
|
eval() {
|
|
return 1;
|
|
},
|
|
arguments() {
|
|
return 2;
|
|
},
|
|
};
|
|
|
|
assertEquals(1, o.eval());
|
|
assertEquals(2, o.arguments());
|
|
})();
|