From 8661e015529e3006cffa007e0c17c97b674825d9 Mon Sep 17 00:00:00 2001 From: Nicholas Shahan Date: Wed, 5 Aug 2020 01:32:06 +0000 Subject: [PATCH] [ddc] Use renamed library name in export Fixes the case where libraries got renamed when created and they are exported. Previously ddc was emitting broken code that incorrectly used the original name in the export. This bug was breaking some benchmarks at runtime. Change-Id: Id8b27d645766db41fb5ccb5c74d8655dd4a5d4ba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157000 Reviewed-by: Sigmund Cherem Reviewed-by: Mark Zhou Commit-Queue: Nicholas Shahan --- pkg/dev_compiler/lib/src/js_ast/printer.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/dev_compiler/lib/src/js_ast/printer.dart b/pkg/dev_compiler/lib/src/js_ast/printer.dart index c7891b40b05..ccf327513f4 100644 --- a/pkg/dev_compiler/lib/src/js_ast/printer.dart +++ b/pkg/dev_compiler/lib/src/js_ast/printer.dart @@ -1326,11 +1326,11 @@ class Printer implements NodeVisitor { if (node.isStar) { out('*'); } else { - var name = node.name.name; + var localName = localNamer.getName(node.name); if (node.asName == null) { // If our local was renamed, generate an implicit "as". // This is a convenience feature so imports and exports can be renamed. - var localName = localNamer.getName(node.name); + var name = node.name.name; if (localName != name) { out(export ? localName : name); out(' as '); @@ -1338,7 +1338,7 @@ class Printer implements NodeVisitor { return; } } - out(name); + out(localName); } if (node.asName != null) { out(' as ');