Skip to content

Commit

Permalink
deps: V8: cherry-pick ea996ad04a68
Browse files Browse the repository at this point in the history
Original commit message:

    [import-attributes] Remove support for numeric keys

    During the 2023-09 TC39 meeting the proposal has been updated to remove support
    for bigint and float literals as import attribute keys, due to implementation
    difficulties in other engines and minimal added value for JS developers.

    GH issue: tc39/proposal-import-attributes#145

    Bug: v8:13856
    Change-Id: I0ede2bb10d6ca338a4b0870a1261ccbcd088c16f
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4899760
    Reviewed-by: Shu-yu Guo <[email protected]>
    Commit-Queue: Joyee Cheung <[email protected]>
    Cr-Commit-Position: refs/heads/main@{#90318}

Refs: v8/v8@ea996ad
PR-URL: #50183
Reviewed-By: Geoffrey Booth <[email protected]>
  • Loading branch information
aduh95 authored and targos committed Nov 11, 2023
1 parent 16fd730 commit 6547bd2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 31 deletions.
2 changes: 1 addition & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.18',
'v8_embedder_string': '-node.19',

##### V8 defaults for Node.js #####

Expand Down
12 changes: 2 additions & 10 deletions deps/v8/src/parsing/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1372,16 +1372,8 @@ ImportAssertions* Parser::ParseImportAssertClause() {
Expect(Token::LBRACE);

while (peek() != Token::RBRACE) {
const AstRawString* attribute_key = nullptr;
if (Check(Token::STRING) || Check(Token::SMI)) {
attribute_key = GetSymbol();
} else if (Check(Token::NUMBER)) {
attribute_key = GetNumberAsSymbol();
} else if (Check(Token::BIGINT)) {
attribute_key = GetBigIntAsSymbol();
} else {
attribute_key = ParsePropertyName();
}
const AstRawString* attribute_key =
Check(Token::STRING) ? GetSymbol() : ParsePropertyName();

Scanner::Location location = scanner()->location();

Expand Down
22 changes: 2 additions & 20 deletions deps/v8/test/unittests/parser/parsing-unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4877,10 +4877,7 @@ TEST_F(ParsingTest, BasicImportAssertionParsing) {
"import { a as b } from 'm.js' assert { c:\n 'd'};",
"import { a as b } from 'm.js' assert { c:'d'\n};",

"import { a as b } from 'm.js' assert { 0: 'b', };",
"import { a as b } from 'm.js' assert { 0n: 'b', };",
"import { a as b } from 'm.js' assert { '0': 'b', };",
"import { a as b } from 'm.js' assert { 0.0: 'b', };",
};
// clang-format on

Expand Down Expand Up @@ -4942,19 +4939,13 @@ TEST_F(ParsingTest, ImportAssertionParsingErrors) {
"import { a } from 'm.js'\n assert { };",
"export * from 'm.js'\n assert { };",

"import { a } from 'm.js' assert { 1: 2 };",
"import { a } from 'm.js' assert { x: 2 };",
"import { a } from 'm.js' assert { b: c };",
"import { a } from 'm.js' assert { 'b': c };",
"import { a } from 'm.js' assert { , b: c };",
"import { a } from 'm.js' assert { a: 'b', a: 'c' };",
"import { a } from 'm.js' assert { a: 'b', 'a': 'c' };",

"import { a } from 'm.js' assert { 0: 'b', '0': 'c' };",
"import { a } from 'm.js' assert { 0n: 'b', '0': 'c' };",
"import { a } from 'm.js' assert { 0: 'b', 0n: 'c' };",
"import { a } from 'm.js' assert { 0: 'b', 0.0: 'c' };",
"import { a } from 'm.js' assert { '0': 'b', 0n: 'c' };",

"import 'm.js' with { a: 'b' };"
};
// clang-format on
Expand Down Expand Up @@ -5008,10 +4999,7 @@ TEST_F(ParsingTest, BasicImportAttributesParsing) {
"import { a as b } from 'm.js' with { c:\n 'd'};",
"import { a as b } from 'm.js' with { c:'d'\n};",

"import { a as b } from 'm.js' with { 0: 'b', };",
"import { a as b } from 'm.js' with { 0n: 'b', };",
"import { a as b } from 'm.js' with { '0': 'b', };",
"import { a as b } from 'm.js' with { 0.0: 'b', };",

"import 'm.js'\n with { };",
"import 'm.js' \nwith { };",
Expand Down Expand Up @@ -5073,19 +5061,13 @@ TEST_F(ParsingTest, ImportAttributesParsingErrors) {
"export { a } with { };",
"export * with { };",

"import { a } from 'm.js' with { 1: 2 };",
"import { a } from 'm.js' with { x: 2 };",
"import { a } from 'm.js' with { b: c };",
"import { a } from 'm.js' with { 'b': c };",
"import { a } from 'm.js' with { , b: c };",
"import { a } from 'm.js' with { a: 'b', a: 'c' };",
"import { a } from 'm.js' with { a: 'b', 'a': 'c' };",

"import { a } from 'm.js' with { 0: 'b', '0': 'c' };",
"import { a } from 'm.js' with { 0n: 'b', '0': 'c' };",
"import { a } from 'm.js' with { 0: 'b', 0n: 'c' };",
"import { a } from 'm.js' with { 0: 'b', 0.0: 'c' };",
"import { a } from 'm.js' with { '0': 'b', 0n: 'c' };",

"import 'm.js' assert { a: 'b' };"
};
// clang-format on
Expand Down

0 comments on commit 6547bd2

Please sign in to comment.