Skip to content

Commit aca53b2

Browse files
natebiggsCommit Queue
authored andcommitted
[js_interop] Use safe name when creating JSExport intermediary var.
Bug: #61140 Change-Id: I01b863338f8cfa01150073286f83820ffe39c256 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441280 Commit-Queue: Nate Biggs <[email protected]> Reviewed-by: Srujan Gaddam <[email protected]>
1 parent f033010 commit aca53b2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/_js_interop_checks/lib/src/transformations/shared_interop_transformer.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class SharedInteropTransformer extends Transformer {
5050
final TypeEnvironment _typeEnvironment;
5151
final Procedure _typeofEquals;
5252

53+
int exportNameIdentifierCounter = 0;
54+
5355
StaticInvocation get invocation => _invocation!;
5456

5557
SharedInteropTransformer(
@@ -395,7 +397,9 @@ class SharedInteropTransformer extends Transformer {
395397
// A new map VariableDeclaration is created and added to the block of
396398
// statements for each export name.
397399
var getSetMap = VariableDeclaration(
398-
'#${exportName}Mapping',
400+
// Don't use the exportName here because it might not be a valid JS
401+
// identifier.
402+
'#${exportNameIdentifierCounter++}Mapping',
399403
initializer: getLiteral(),
400404
type: ExtensionType(_jsObject, Nullability.nonNullable),
401405
isSynthesized: true,

0 commit comments

Comments
 (0)