Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /// A transformation to create a self-contained modular kernel without | 5 /// A transformation to create a self-contained modular kernel without |
| 6 /// unnecessary references to other libraries. | 6 /// unnecessary references to other libraries. |
| 7 library fasta.kernel.kernel_outline_shaker; | 7 library fasta.kernel.kernel_outline_shaker; |
| 8 | 8 |
| 9 import 'package:kernel/ast.dart'; | 9 import 'package:kernel/ast.dart'; |
| 10 import 'package:kernel/core_types.dart'; | 10 import 'package:kernel/core_types.dart'; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 void markLibrary(Library lib) { | 93 void markLibrary(Library lib) { |
| 94 libraries.add(lib); | 94 libraries.add(lib); |
| 95 } | 95 } |
| 96 | 96 |
| 97 /// Mark a class and it's supertypes as used. | 97 /// Mark a class and it's supertypes as used. |
| 98 void markClass(Class cls) { | 98 void markClass(Class cls) { |
| 99 if (cls == null || !classes.add(cls)) return; | 99 if (cls == null || !classes.add(cls)) return; |
| 100 markLibrary(cls.parent); | 100 markLibrary(cls.parent); |
| 101 // TODO(sigmund): retain annotations? | 101 // TODO(sigmund): retain annotations? |
| 102 // visitList(cls.annotations, this); | 102 // visitList(cls.annotations, this); |
| 103 cls.typeParameters.forEach((t) => t.bound.accept(typeMarker)); | |
| 103 markSupertype(cls.supertype); | 104 markSupertype(cls.supertype); |
| 104 markSupertype(cls.mixedInType); | 105 markSupertype(cls.mixedInType); |
| 105 cls.implementedTypes.forEach(markSupertype); | 106 cls.implementedTypes.forEach(markSupertype); |
| 106 cls.typeParameters.forEach((t) => t.bound.accept(typeMarker)); | 107 cls.members.forEach((member) { |
| 108 if (!member.name.isPrivate) { | |
| 109 markMember(member); | |
|
Paul Berry
2017/08/30 21:46:45
I think we should exclude constructors and static
| |
| 110 } | |
| 111 }); | |
| 107 } | 112 } |
| 108 | 113 |
| 109 /// Mark the typedef. | 114 /// Mark the typedef. |
| 110 void markTypedef(Typedef node) { | 115 void markTypedef(Typedef node) { |
| 111 if (node == null || !typedefs.add(node)) return; | 116 if (node == null || !typedefs.add(node)) return; |
| 112 markLibrary(node.parent); | 117 markLibrary(node.parent); |
| 113 } | 118 } |
| 114 | 119 |
| 115 /// Mark the class and type arguments of [node]. | 120 /// Mark the class and type arguments of [node]. |
| 116 void markSupertype(Supertype node) { | 121 void markSupertype(Supertype node) { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 } else { | 436 } else { |
| 432 node.transformChildren(this); | 437 node.transformChildren(this); |
| 433 return node; | 438 return node; |
| 434 } | 439 } |
| 435 } | 440 } |
| 436 | 441 |
| 437 TreeNode defaultTreeNode(TreeNode node) => node; | 442 TreeNode defaultTreeNode(TreeNode node) => node; |
| 438 } | 443 } |
| 439 | 444 |
| 440 typedef bool Filter(Uri uri); | 445 typedef bool Filter(Uri uri); |
| OLD | NEW |