Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: pkg/front_end/lib/src/fasta/source/source_loader.dart

Issue 2918593003: Pass ClassHierarchy instead of creating it. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 library fasta.source_loader; 5 library fasta.source_loader;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:typed_data' show Uint8List; 9 import 'dart:typed_data' show Uint8List;
10 10
11 import 'package:front_end/file_system.dart'; 11 import 'package:front_end/file_system.dart';
12 import 'package:front_end/src/base/instrumentation.dart' show Instrumentation; 12 import 'package:front_end/src/base/instrumentation.dart' show Instrumentation;
13 13
14 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart' 14 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'
15 show KernelTypeInferenceEngine; 15 show KernelTypeInferenceEngine;
16 16
17 import 'package:front_end/src/fasta/kernel/kernel_target.dart' 17 import 'package:front_end/src/fasta/kernel/kernel_target.dart'
18 show KernelTarget; 18 show KernelTarget;
19 19
20 import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart' 20 import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart'
21 show TypeInferenceEngine; 21 show TypeInferenceEngine;
22 22
23 import 'package:kernel/ast.dart' show Program; 23 import 'package:kernel/ast.dart' show Program;
24 24
25 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; 25 import 'package:kernel/class_hierarchy.dart'
26 show ClassHierarchy, ClosedWorldClassHierarchy;
26 27
27 import 'package:kernel/core_types.dart' show CoreTypes; 28 import 'package:kernel/core_types.dart' show CoreTypes;
28 29
29 import '../builder/builder.dart' 30 import '../builder/builder.dart'
30 show 31 show
31 Builder, 32 Builder,
32 ClassBuilder, 33 ClassBuilder,
33 EnumBuilder, 34 EnumBuilder,
34 LibraryBuilder, 35 LibraryBuilder,
35 NamedTypeBuilder, 36 NamedTypeBuilder,
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 void buildProgram() { 434 void buildProgram() {
434 builders.forEach((Uri uri, LibraryBuilder library) { 435 builders.forEach((Uri uri, LibraryBuilder library) {
435 if (library is SourceLibraryBuilder) { 436 if (library is SourceLibraryBuilder) {
436 libraries.add(library.build(coreLibrary)); 437 libraries.add(library.build(coreLibrary));
437 } 438 }
438 }); 439 });
439 ticker.logMs("Built program"); 440 ticker.logMs("Built program");
440 } 441 }
441 442
442 void computeHierarchy(Program program) { 443 void computeHierarchy(Program program) {
443 hierarchy = new ClassHierarchy(program); 444 hierarchy = new ClosedWorldClassHierarchy(program);
444 ticker.logMs("Computed class hierarchy"); 445 ticker.logMs("Computed class hierarchy");
445 coreTypes = new CoreTypes(program); 446 coreTypes = new CoreTypes(program);
446 ticker.logMs("Computed core types"); 447 ticker.logMs("Computed core types");
447 } 448 }
448 449
449 void checkOverrides(List<SourceClassBuilder> sourceClasses) { 450 void checkOverrides(List<SourceClassBuilder> sourceClasses) {
450 assert(hierarchy != null); 451 assert(hierarchy != null);
451 for (SourceClassBuilder builder in sourceClasses) { 452 for (SourceClassBuilder builder in sourceClasses) {
452 builder.checkOverrides(hierarchy); 453 builder.checkOverrides(hierarchy);
453 } 454 }
(...skipping 22 matching lines...) Expand all
476 /// Performs the second phase of top level initializer inference, which is to 477 /// Performs the second phase of top level initializer inference, which is to
477 /// visit fields and top level variables in topologically-sorted order and 478 /// visit fields and top level variables in topologically-sorted order and
478 /// assign their types. 479 /// assign their types.
479 void performInitializerInference() { 480 void performInitializerInference() {
480 typeInferenceEngine.finishTopLevel(); 481 typeInferenceEngine.finishTopLevel();
481 ticker.logMs("Performed initializer inference"); 482 ticker.logMs("Performed initializer inference");
482 } 483 }
483 484
484 List<Uri> getDependencies() => sourceBytes.keys.toList(); 485 List<Uri> getDependencies() => sourceBytes.keys.toList();
485 } 486 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698