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 |
| 108 for (var field in cls.fields) { |
| 109 if (!field.isStatic && !field.name.isPrivate) { |
| 110 markMember(field); |
| 111 } |
| 112 } |
| 113 for (var method in cls.procedures) { |
| 114 if (!method.isStatic && !method.name.isPrivate) { |
| 115 markMember(method); |
| 116 } |
| 117 } |
107 } | 118 } |
108 | 119 |
109 /// Mark the typedef. | 120 /// Mark the typedef. |
110 void markTypedef(Typedef node) { | 121 void markTypedef(Typedef node) { |
111 if (node == null || !typedefs.add(node)) return; | 122 if (node == null || !typedefs.add(node)) return; |
112 markLibrary(node.parent); | 123 markLibrary(node.parent); |
113 } | 124 } |
114 | 125 |
115 /// Mark the class and type arguments of [node]. | 126 /// Mark the class and type arguments of [node]. |
116 void markSupertype(Supertype node) { | 127 void markSupertype(Supertype node) { |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } else { | 442 } else { |
432 node.transformChildren(this); | 443 node.transformChildren(this); |
433 return node; | 444 return node; |
434 } | 445 } |
435 } | 446 } |
436 | 447 |
437 TreeNode defaultTreeNode(TreeNode node) => node; | 448 TreeNode defaultTreeNode(TreeNode node) => node; |
438 } | 449 } |
439 | 450 |
440 typedef bool Filter(Uri uri); | 451 typedef bool Filter(Uri uri); |
OLD | NEW |