[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 <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Nicholas Shahan 2020-08-05 01:32:06 +00:00 committed by commit-bot@chromium.org
parent 363c72111d
commit 8661e01552

View file

@ -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 ');