| 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'; |
| 11 | 11 |
| 12 import '../errors.dart' show internalError; | 12 import '../errors.dart' show internalError; |
| 13 | 13 |
| 14 /// Removes from [program] unnecessary libraries, classes, and members. | 14 /// Removes unnecessary libraries, classes, and members from [program]. |
| 15 /// | 15 /// |
| 16 /// This applies a simple "tree-shaking" technique: the full body of libraries | 16 /// This applies a simple "tree-shaking" technique: the full body of libraries |
| 17 /// whose URI match [isIncluded] is preserved, and so is the outline of the | 17 /// whose URI match [isIncluded] is preserved, and so is the outline of the |
| 18 /// members and classes which are indicated by [data] (which should | 18 /// members and classes which are indicated by [data] (which should |
| 19 /// practically include all members and classes transitively visible from the | 19 /// practically include all members and classes transitively visible from the |
| 20 /// included libraries). | 20 /// included libraries). |
| 21 /// | 21 /// |
| 22 /// The intent is that the resulting program has the entire code that is meant | 22 /// The intent is that the resulting program has the entire code that is meant |
| 23 /// to be included and the minimum required to prevent dangling references and | 23 /// to be included and the minimum required to prevent dangling references and |
| 24 /// allow modular program transformations. | 24 /// allow modular program transformations. |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 /// Types appear to be encoded directly, so we have no need to preserve | 397 /// Types appear to be encoded directly, so we have no need to preserve |
| 398 /// typedefs. | 398 /// typedefs. |
| 399 // TODO(sigmund): revisit if this is not the case, the `inputError` in | 399 // TODO(sigmund): revisit if this is not the case, the `inputError` in |
| 400 // [RootsMarker] is meant to detect this. | 400 // [RootsMarker] is meant to detect this. |
| 401 Typedef visitTypedef(Typedef node) => null; | 401 Typedef visitTypedef(Typedef node) => null; |
| 402 | 402 |
| 403 TreeNode defaultTreeNode(TreeNode node) => node; | 403 TreeNode defaultTreeNode(TreeNode node) => node; |
| 404 } | 404 } |
| 405 | 405 |
| 406 typedef bool Filter(Uri uri); | 406 typedef bool Filter(Uri uri); |
| OLD | NEW |