exportsOf method

  1. @override
List<List> exportsOf(
  1. String fileId, {
  2. bool includeParts = true,
})
inherited

Returns a list of all the exports and parts of a file.

This has an option to include parts because in some contexts of this application parts are considered exports as they export their references to the main file.

Implementation

@override
List<List<dynamic>> exportsOf(String fileId, {bool includeParts = true}) {
  final List<List<dynamic>>? fileDirectives = directives[fileId];
  if (fileDirectives == null) return <List<dynamic>>[];
  return List<List<dynamic>>.of(
    fileDirectives.where((List<dynamic> e) {
      if (e[GraphIndex.directiveType] == DirectiveStatement.export) {
        return true;
      } else if (includeParts && e[GraphIndex.directiveType] == DirectiveStatement.part) {
        return true;
      }
      return false;
    }),
  );
}