a09c076f00
This change completes support for import assertions for dynamic import(). A new version of the HostImportModuleDynamically callback taking import assertions is added to the public API. The name is very verbose; we could consider removing the "ImportAssertions" part when the old API is removed. Bytecode generation is updated to pass the assertions, if present, to Runtime_DynamicImportCall. Isolate::RunHostImportModuleDynamicallyCallback extracts the assertions from the options bag, filters out the assertions not present in the list specified by the host in HostGetSupportedImportAssertions, and sorts them by code point order of the keys per https://tc39.es/proposal-import-assertions/#sec-import-call-runtime-semantics-evaluation. The resulting array is passed to the host in the callback. Bug: v8:10958 Change-Id: I931df00f954a9f9c65bff5bcf461ba1c8f11e94e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2620578 Commit-Queue: Dan Clark <daniec@microsoft.com> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Mythri Alle <mythria@chromium.org> Reviewed-by: Marja Hölttä <marja@chromium.org> Cr-Commit-Position: refs/heads/master@{#72307}
10 lines
328 B
JavaScript
10 lines
328 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.
|
|
|
|
// Flags: --harmony-import-assertions
|
|
|
|
import json from 'modules-skip-1.json' assert { type: 'json', notARealAssertion: 'value'};
|
|
|
|
assertEquals(42, json.life);
|