Skip to content

Commit ae5a4db

Browse files
sygV8 LUCI CQ
authored andcommitted
[import-attributes] Deprecate 'assert' for removal in 12.6
See https://groups.google.com/a/chromium.org/g/blink-dev/c/ZHvzLaJZRvo/m/FgNDBjrtBQAJ Bug: v8:10958 Change-Id: I4d21c9f7aad1024b198b4a1cdfb4792a011da464 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5055681 Reviewed-by: Rezvan Mahdavi Hezaveh <[email protected]> Auto-Submit: Shu-yu Guo <[email protected]> Commit-Queue: Shu-yu Guo <[email protected]> Cr-Commit-Position: refs/heads/main@{#92044}
1 parent 1f0d9cf commit ae5a4db

7 files changed

Lines changed: 30 additions & 22 deletions

File tree

src/common/message-template.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ namespace internal {
115115
T(IllegalInvocation, "Illegal invocation") \
116116
T(ImmutablePrototypeSet, \
117117
"Immutable prototype object '%' cannot have their prototype set") \
118+
T(ImportAssertDeprecated, \
119+
"'assert' is deprecated in import statements and support will be removed " \
120+
"in %; use 'with' instead") \
118121
T(ImportAssertionDuplicateKey, "Import assertion has duplicate key '%'") \
119122
T(ImportCallNotNewExpression, "Cannot use new with import") \
120123
T(ImportOutsideModule, "Cannot use import statement outside a module") \

src/parsing/parser.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,9 @@ ImportAttributes* Parser::ParseImportWithOrAssertClause() {
14301430
//
14311431
// TODO(v8:13856): Remove once decision is made to unship 'assert' or keep.
14321432
++use_counts_[v8::Isolate::kImportAssertionDeprecatedSyntax];
1433+
info_->pending_error_handler()->ReportWarningAt(
1434+
position(), end_position(), MessageTemplate::kImportAssertDeprecated,
1435+
"12.6");
14331436
} else {
14341437
return import_attributes;
14351438
}

test/message/fail/modules-import-assertions-fail-1.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
*%(basename)s:9: 'assert' is deprecated in import statements and support will be removed in 12.6; use 'with' instead
12
undefined:0: Error: Invalid module type was asserted
23

34

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
*%(basename)s:9: 'assert' is deprecated in import statements and support will be removed in 12.6; use 'with' instead
12
undefined:1: SyntaxError: Unexpected token '/', "// Copyrig"... is not valid JSON
23
// Copyright 2021 the V8 project authors. All rights reserved.
34
^
4-
SyntaxError: Unexpected token '/', "// Copyrig"... is not valid JSON
5+
SyntaxError: Unexpected token '/', "// Copyrig"... is not valid JSON

test/unittests/interpreter/bytecode_expectations/PrivateAccessorAccess.golden

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ bytecodes: [
8383
/* 48 E> */ B(DefineKeyedOwnProperty), R(this), R(0), U8(0), U8(0),
8484
/* 53 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
8585
/* 58 E> */ B(GetKeyedProperty), R(this), U8(2),
86-
B(Wide), B(LdaSmi), I16(319),
86+
B(Wide), B(LdaSmi), I16(320),
8787
B(Star2),
8888
B(LdaConstant), U8(0),
8989
B(Star3),
@@ -115,7 +115,7 @@ bytecodes: [
115115
/* 41 E> */ B(DefineKeyedOwnProperty), R(this), R(0), U8(0), U8(0),
116116
/* 46 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
117117
/* 51 E> */ B(GetKeyedProperty), R(this), U8(2),
118-
B(Wide), B(LdaSmi), I16(318),
118+
B(Wide), B(LdaSmi), I16(319),
119119
B(Star2),
120120
B(LdaConstant), U8(0),
121121
B(Star3),
@@ -149,7 +149,7 @@ bytecodes: [
149149
B(Star2),
150150
B(LdaImmutableCurrentContextSlot), U8(3),
151151
/* 58 E> */ B(GetKeyedProperty), R(this), U8(2),
152-
B(Wide), B(LdaSmi), I16(319),
152+
B(Wide), B(LdaSmi), I16(320),
153153
B(Star3),
154154
B(LdaConstant), U8(0),
155155
B(Star4),
@@ -181,7 +181,7 @@ bytecodes: [
181181
/* 41 E> */ B(DefineKeyedOwnProperty), R(this), R(0), U8(0), U8(0),
182182
/* 46 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
183183
/* 51 E> */ B(GetKeyedProperty), R(this), U8(2),
184-
B(Wide), B(LdaSmi), I16(318),
184+
B(Wide), B(LdaSmi), I16(319),
185185
B(Star2),
186186
B(LdaConstant), U8(0),
187187
B(Star3),

test/unittests/interpreter/bytecode_expectations/PrivateMethodAccess.golden

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ bytecodes: [
5858
B(Star2),
5959
B(LdaImmutableCurrentContextSlot), U8(3),
6060
/* 54 E> */ B(GetKeyedProperty), R(this), U8(2),
61-
B(Wide), B(LdaSmi), I16(317),
61+
B(Wide), B(LdaSmi), I16(318),
6262
B(Star3),
6363
B(LdaConstant), U8(0),
6464
B(Star4),
@@ -91,7 +91,7 @@ bytecodes: [
9191
/* 44 E> */ B(DefineKeyedOwnProperty), R(this), R(0), U8(0), U8(0),
9292
/* 49 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
9393
/* 54 E> */ B(GetKeyedProperty), R(this), U8(2),
94-
B(Wide), B(LdaSmi), I16(317),
94+
B(Wide), B(LdaSmi), I16(318),
9595
B(Star2),
9696
B(LdaConstant), U8(0),
9797
B(Star3),

test/unittests/interpreter/bytecode_expectations/StaticPrivateMethodAccess.golden

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ bytecodes: [
2424
B(TestReferenceEqual), R(this),
2525
B(Mov), R(this), R(1),
2626
B(JumpIfTrue), U8(16),
27-
B(Wide), B(LdaSmi), I16(311),
27+
B(Wide), B(LdaSmi), I16(312),
2828
B(Star2),
2929
B(LdaConstant), U8(0),
3030
B(Star3),
@@ -61,13 +61,13 @@ bytecodes: [
6161
B(TestReferenceEqual), R(this),
6262
B(Mov), R(this), R(0),
6363
B(JumpIfTrue), U8(16),
64-
B(Wide), B(LdaSmi), I16(311),
64+
B(Wide), B(LdaSmi), I16(312),
6565
B(Star2),
6666
B(LdaConstant), U8(0),
6767
B(Star3),
6868
/* 61 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(2), U8(2),
6969
B(Throw),
70-
B(Wide), B(LdaSmi), I16(317),
70+
B(Wide), B(LdaSmi), I16(318),
7171
B(Star2),
7272
B(LdaConstant), U8(1),
7373
B(Star3),
@@ -99,13 +99,13 @@ bytecodes: [
9999
B(TestReferenceEqual), R(this),
100100
B(Mov), R(this), R(0),
101101
B(JumpIfTrue), U8(16),
102-
B(Wide), B(LdaSmi), I16(311),
102+
B(Wide), B(LdaSmi), I16(312),
103103
B(Star1),
104104
B(LdaConstant), U8(0),
105105
B(Star2),
106106
/* 61 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(1), U8(2),
107107
B(Throw),
108-
B(Wide), B(LdaSmi), I16(317),
108+
B(Wide), B(LdaSmi), I16(318),
109109
B(Star1),
110110
B(LdaConstant), U8(1),
111111
B(Star2),
@@ -145,7 +145,7 @@ bytecodes: [
145145
B(TestReferenceEqual), R(this),
146146
B(Mov), R(this), R(0),
147147
B(JumpIfTrue), U8(16),
148-
B(Wide), B(LdaSmi), I16(311),
148+
B(Wide), B(LdaSmi), I16(312),
149149
B(Star2),
150150
B(LdaConstant), U8(0),
151151
B(Star3),
@@ -167,7 +167,7 @@ bytecodes: [
167167
B(TestReferenceEqual), R(this),
168168
B(Mov), R(this), R(0),
169169
B(JumpIfTrue), U8(16),
170-
B(Wide), B(LdaSmi), I16(311),
170+
B(Wide), B(LdaSmi), I16(312),
171171
B(Star3),
172172
B(LdaConstant), U8(0),
173173
B(Star4),
@@ -182,7 +182,7 @@ bytecodes: [
182182
B(TestReferenceEqual), R(this),
183183
B(Mov), R(this), R(0),
184184
B(JumpIfTrue), U8(16),
185-
B(Wide), B(LdaSmi), I16(311),
185+
B(Wide), B(LdaSmi), I16(312),
186186
B(Star2),
187187
B(LdaConstant), U8(0),
188188
B(Star3),
@@ -216,13 +216,13 @@ bytecodes: [
216216
B(TestReferenceEqual), R(this),
217217
B(Mov), R(this), R(0),
218218
B(JumpIfTrue), U8(16),
219-
B(Wide), B(LdaSmi), I16(311),
219+
B(Wide), B(LdaSmi), I16(312),
220220
B(Star1),
221221
B(LdaConstant), U8(0),
222222
B(Star2),
223223
/* 65 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(1), U8(2),
224224
B(Throw),
225-
B(Wide), B(LdaSmi), I16(319),
225+
B(Wide), B(LdaSmi), I16(320),
226226
B(Star1),
227227
B(LdaConstant), U8(1),
228228
B(Star2),
@@ -253,13 +253,13 @@ bytecodes: [
253253
B(TestReferenceEqual), R(this),
254254
B(Mov), R(this), R(0),
255255
B(JumpIfTrue), U8(16),
256-
B(Wide), B(LdaSmi), I16(311),
256+
B(Wide), B(LdaSmi), I16(312),
257257
B(Star1),
258258
B(LdaConstant), U8(0),
259259
B(Star2),
260260
/* 58 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(1), U8(2),
261261
B(Throw),
262-
B(Wide), B(LdaSmi), I16(318),
262+
B(Wide), B(LdaSmi), I16(319),
263263
B(Star1),
264264
B(LdaConstant), U8(1),
265265
B(Star2),
@@ -292,13 +292,13 @@ bytecodes: [
292292
B(TestReferenceEqual), R(this),
293293
B(Mov), R(this), R(0),
294294
B(JumpIfTrue), U8(16),
295-
B(Wide), B(LdaSmi), I16(311),
295+
B(Wide), B(LdaSmi), I16(312),
296296
B(Star2),
297297
B(LdaConstant), U8(0),
298298
B(Star3),
299299
/* 65 E> */ B(CallRuntime), U16(Runtime::kNewTypeError), R(2), U8(2),
300300
B(Throw),
301-
B(Wide), B(LdaSmi), I16(319),
301+
B(Wide), B(LdaSmi), I16(320),
302302
B(Star2),
303303
B(LdaConstant), U8(1),
304304
B(Star3),
@@ -327,7 +327,7 @@ bytecode array length: 19
327327
bytecodes: [
328328
/* 46 S> */ B(LdaImmutableCurrentContextSlot), U8(3),
329329
/* 51 E> */ B(GetKeyedProperty), R(this), U8(0),
330-
B(Wide), B(LdaSmi), I16(318),
330+
B(Wide), B(LdaSmi), I16(319),
331331
B(Star1),
332332
B(LdaConstant), U8(0),
333333
B(Star2),

0 commit comments

Comments
 (0)