<commit_before>// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library fasta.dill_loader;

import 'dart:async' show Future;

import 'package:kernel/ast.dart' show Library, Program;

import '../loader.dart' show Loader;
import '../target_implementation.dart' show TargetImplementation;
import 'dill_library_builder.dart' show DillLibraryBuilder;

class DillLoader extends Loader<Library> {
  /// Source targets are compiled against these binary libraries.
  final libraries = <Library>[];

  DillLoader(TargetImplementation target) : super(target);

  /// Append compiled libraries from the given [program]. If the [filter] is
  /// provided, append only libraries whose [Uri] is accepted by the [filter].
  List<DillLibraryBuilder> appendLibraries(Program program,
      [bool filter(Uri uri)]) {
    var builders = <DillLibraryBuilder>[];
    for (Library library in program.libraries) {
      if (filter == null || filter(library.importUri)) {
        libraries.add(library);
        DillLibraryBuilder builder = read(library.importUri);
        builder.library = library;
        builders.add(builder);
      }
    }
    return builders;
  }

  Future<Null> buildBody(DillLibraryBuilder builder) {
    return buildOutline(builder);
  }

  Future<Null> buildOutline(DillLibraryBuilder builder) async {
    builder.library.classes.forEach(builder.addClass);
    builder.library.procedures.forEach(builder.addMember);
    builder.library.typedefs.forEach(builder.addTypedef);
    builder.library.fields.forEach(builder.addMember);
  }

  DillLibraryBuilder read(Uri uri, [Uri fileUri]) => super.read(uri, fileUri);
}
<commit_msg>Unsort methods from CL 2872903005.<commit_after>// Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library fasta.dill_loader;

import 'dart:async' show Future;

import 'package:kernel/ast.dart' show Library, Program;

import '../loader.dart' show Loader;
import '../target_implementation.dart' show TargetImplementation;
import 'dill_library_builder.dart' show DillLibraryBuilder;

class DillLoader extends Loader<Library> {
  /// Source targets are compiled against these binary libraries.
  final libraries = <Library>[];

  DillLoader(TargetImplementation target) : super(target);

  /// Append compiled libraries from the given [program]. If the [filter] is
  /// provided, append only libraries whose [Uri] is accepted by the [filter].
  List<DillLibraryBuilder> appendLibraries(Program program,
      [bool filter(Uri uri)]) {
    var builders = <DillLibraryBuilder>[];
    for (Library library in program.libraries) {
      if (filter == null || filter(library.importUri)) {
        libraries.add(library);
        DillLibraryBuilder builder = read(library.importUri);
        builder.library = library;
        builders.add(builder);
      }
    }
    return builders;
  }

  DillLibraryBuilder read(Uri uri, [Uri fileUri]) => super.read(uri, fileUri);

  Future<Null> buildOutline(DillLibraryBuilder builder) async {
    builder.library.classes.forEach(builder.addClass);
    builder.library.procedures.forEach(builder.addMember);
    builder.library.typedefs.forEach(builder.addTypedef);
    builder.library.fields.forEach(builder.addMember);
  }

  Future<Null> buildBody(DillLibraryBuilder builder) {
    return buildOutline(builder);
  }
}

{'fraction_non_alphanumeric': 0.10533591374066906, 'fraction_numerical': 0.0049764998617638926, 'mean_word_length': 4.110169491525424, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7314112', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1008, 'n_words': 298}