fd75c97d3f
Calls with a spread expression in a non-final position get transformed to calls to Reflect.apply. This transformation is currently done in the parser, which does not compose well with other features (e.g. direct eval checking, optional chaining). Do this transform in the BytecodeGenerator instead. Bug: v8:11573, v8:11558, v8:5690 Change-Id: I56c90a2036fe5b43e0897c57766f666bf72bc3a8 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2765783 Auto-Submit: Shu-yu Guo <syg@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/master@{#73534}
18 lines
552 B
JavaScript
18 lines
552 B
JavaScript
// Copyright 2021 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.
|
|
|
|
// Spread calls get rewritten to CallRuntime, which should be aware of optional
|
|
// chaining.
|
|
|
|
for (let nullish of [undefined, null]) {
|
|
const fn = nullish;
|
|
const n = nullish;
|
|
const o = {};
|
|
|
|
assertEquals(fn?.(...[], 1), undefined);
|
|
assertEquals(fn?.(...[], ...[]), undefined);
|
|
assertEquals(o.method?.(...[], 1), undefined);
|
|
assertEquals(n?.method(...[], 1), undefined);
|
|
}
|