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

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

Issue 2665723002: Implement canonical name scheme in kernel. (Closed)
Patch Set: Address Kevin's 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 27ef8fb61699d24a03c528567a191cb3f0c15184..b4c331b72578d263c5b222c6f156d6e36b9dca1a 100644
--- a/pkg/kernel/lib/transformations/treeshaker.dart
+++ b/pkg/kernel/lib/transformations/treeshaker.dart
@@ -896,16 +896,6 @@ class _TreeShakingTransformer extends Transformer {
}
void transform(Program program) {
- for (var library in program.libraries) {
- if (!shaker.forceShaking && 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
@@ -919,11 +909,22 @@ class _TreeShakingTransformer extends Transformer {
node.interfaceTarget = _translateInterfaceTarget(node.interfaceTarget);
}
}
+ for (var library in program.libraries) {
+ if (!shaker.forceShaking && 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:
@@ -954,6 +955,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) {
« no previous file with comments | « pkg/kernel/lib/transformations/mixin_full_resolution.dart ('k') | pkg/kernel/lib/type_propagation/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698