Skip to content

Commit 6547bd2

Browse files
aduh95targos
authored andcommitted
deps: V8: cherry-pick ea996ad04a68
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]>
1 parent 16fd730 commit 6547bd2

File tree

3 files changed

+5
-31
lines changed

3 files changed

+5
-31
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

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

4141
##### V8 defaults for Node.js #####
4242

deps/v8/src/parsing/parser.cc

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,16 +1372,8 @@ ImportAssertions* Parser::ParseImportAssertClause() {
13721372
Expect(Token::LBRACE);
13731373

13741374
while (peek() != Token::RBRACE) {
1375-
const AstRawString* attribute_key = nullptr;
1376-
if (Check(Token::STRING) || Check(Token::SMI)) {
1377-
attribute_key = GetSymbol();
1378-
} else if (Check(Token::NUMBER)) {
1379-
attribute_key = GetNumberAsSymbol();
1380-
} else if (Check(Token::BIGINT)) {
1381-
attribute_key = GetBigIntAsSymbol();
1382-
} else {
1383-
attribute_key = ParsePropertyName();
1384-
}
1375+
const AstRawString* attribute_key =
1376+
Check(Token::STRING) ? GetSymbol() : ParsePropertyName();
13851377

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

deps/v8/test/unittests/parser/parsing-unittest.cc

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4877,10 +4877,7 @@ TEST_F(ParsingTest, BasicImportAssertionParsing) {
48774877
"import { a as b } from 'm.js' assert { c:\n 'd'};",
48784878
"import { a as b } from 'm.js' assert { c:'d'\n};",
48794879

4880-
"import { a as b } from 'm.js' assert { 0: 'b', };",
4881-
"import { a as b } from 'm.js' assert { 0n: 'b', };",
48824880
"import { a as b } from 'm.js' assert { '0': 'b', };",
4883-
"import { a as b } from 'm.js' assert { 0.0: 'b', };",
48844881
};
48854882
// clang-format on
48864883

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

4945-
"import { a } from 'm.js' assert { 1: 2 };",
4942+
"import { a } from 'm.js' assert { x: 2 };",
49464943
"import { a } from 'm.js' assert { b: c };",
49474944
"import { a } from 'm.js' assert { 'b': c };",
49484945
"import { a } from 'm.js' assert { , b: c };",
49494946
"import { a } from 'm.js' assert { a: 'b', a: 'c' };",
49504947
"import { a } from 'm.js' assert { a: 'b', 'a': 'c' };",
49514948

4952-
"import { a } from 'm.js' assert { 0: 'b', '0': 'c' };",
4953-
"import { a } from 'm.js' assert { 0n: 'b', '0': 'c' };",
4954-
"import { a } from 'm.js' assert { 0: 'b', 0n: 'c' };",
4955-
"import { a } from 'm.js' assert { 0: 'b', 0.0: 'c' };",
4956-
"import { a } from 'm.js' assert { '0': 'b', 0n: 'c' };",
4957-
49584949
"import 'm.js' with { a: 'b' };"
49594950
};
49604951
// clang-format on
@@ -5008,10 +4999,7 @@ TEST_F(ParsingTest, BasicImportAttributesParsing) {
50084999
"import { a as b } from 'm.js' with { c:\n 'd'};",
50095000
"import { a as b } from 'm.js' with { c:'d'\n};",
50105001

5011-
"import { a as b } from 'm.js' with { 0: 'b', };",
5012-
"import { a as b } from 'm.js' with { 0n: 'b', };",
50135002
"import { a as b } from 'm.js' with { '0': 'b', };",
5014-
"import { a as b } from 'm.js' with { 0.0: 'b', };",
50155003

50165004
"import 'm.js'\n with { };",
50175005
"import 'm.js' \nwith { };",
@@ -5073,19 +5061,13 @@ TEST_F(ParsingTest, ImportAttributesParsingErrors) {
50735061
"export { a } with { };",
50745062
"export * with { };",
50755063

5076-
"import { a } from 'm.js' with { 1: 2 };",
5064+
"import { a } from 'm.js' with { x: 2 };",
50775065
"import { a } from 'm.js' with { b: c };",
50785066
"import { a } from 'm.js' with { 'b': c };",
50795067
"import { a } from 'm.js' with { , b: c };",
50805068
"import { a } from 'm.js' with { a: 'b', a: 'c' };",
50815069
"import { a } from 'm.js' with { a: 'b', 'a': 'c' };",
50825070

5083-
"import { a } from 'm.js' with { 0: 'b', '0': 'c' };",
5084-
"import { a } from 'm.js' with { 0n: 'b', '0': 'c' };",
5085-
"import { a } from 'm.js' with { 0: 'b', 0n: 'c' };",
5086-
"import { a } from 'm.js' with { 0: 'b', 0.0: 'c' };",
5087-
"import { a } from 'm.js' with { '0': 'b', 0n: 'c' };",
5088-
50895071
"import 'm.js' assert { a: 'b' };"
50905072
};
50915073
// clang-format on

0 commit comments

Comments
 (0)