7a38b927c8
Lexically declared "arguments" in sloppy mode will throw redeclaration error currently, this patch fixes it by delaying the declaration of arguments until we fully parse parameter list and function body. BUG=v8:4577 LOG=N Committed: https://crrev.com/70a613dd0a5f5d205b46559b55702764464851fa Review-Url: https://codereview.chromium.org/2290753003 Cr-Original-Commit-Position: refs/heads/master@{#39109} Cr-Commit-Position: refs/heads/master@{#39230}
22 lines
492 B
JavaScript
22 lines
492 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.
|
|
|
|
function f(...arguments) {
|
|
return Array.isArray(arguments);
|
|
}
|
|
assertTrue(f());
|
|
|
|
function g({arguments}) {
|
|
return arguments === 42;
|
|
}
|
|
assertTrue(g({arguments: 42}));
|
|
|
|
function foo() {
|
|
let arguments = 2;
|
|
return arguments;
|
|
}
|
|
assertEquals(2, foo());
|
|
|
|
assertThrows(function(x = arguments, arguments) {}, ReferenceError);
|