Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: pkg/kernel/lib/transformations/treeshaker.dart

Issue 2665723002: Implement canonical name scheme in kernel. (Closed)
Patch Set: Address more comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/kernel/lib/transformations/treeshaker.dart
diff --git a/pkg/kernel/lib/transformations/treeshaker.dart b/pkg/kernel/lib/transformations/treeshaker.dart
index 90540a0283633ab252284d88eaef1ed179a4837c..d381413bcbf0489c65bcfbf8712e00aa42fa0a9b 100644
--- a/pkg/kernel/lib/transformations/treeshaker.dart
+++ b/pkg/kernel/lib/transformations/treeshaker.dart
@@ -807,16 +807,6 @@ class _TreeShakingTransformer extends Transformer {
}
void transform(Program program) {
- for (var library in program.libraries) {
- if (library.importUri.scheme == 'dart') {
- // The backend expects certain things to be present in the core
- // libraries, so we currently don't shake off anything there.
- continue;
- }
- library.transformChildren(this);
- // Note: we can't shake off empty libraries yet since we don't check if
- // there are private names that use the library.
- }
for (Expression node in shaker._typedCalls) {
// We should not leave dangling references, so if the target of a typed
// call has been removed, we must remove the reference. The receiver of
@@ -830,11 +820,22 @@ class _TreeShakingTransformer extends Transformer {
node.interfaceTarget = _translateInterfaceTarget(node.interfaceTarget);
}
}
+ for (var library in program.libraries) {
+ if (library.importUri.scheme == 'dart') {
+ // The backend expects certain things to be present in the core
+ // libraries, so we currently don't shake off anything there.
+ continue;
+ }
+ library.transformChildren(this);
+ // Note: we can't shake off empty libraries yet since we don't check if
+ // there are private names that use the library.
+ }
}
Class visitClass(Class node) {
switch (shaker.getClassRetention(node)) {
case ClassRetention.None:
+ node.canonicalName.unbind();
return null; // Remove the class.
case ClassRetention.Namespace:
@@ -865,6 +866,7 @@ class _TreeShakingTransformer extends Transformer {
Member defaultMember(Member node) {
if (!shaker.isMemberBodyUsed(node)) {
if (!shaker.isMemberOverridden(node)) {
+ node.canonicalName.unbind();
return null;
}
if (node is Procedure) {

Powered by Google App Engine
This is Rietveld 408576698