mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:47:36 +00:00
Remove ClassHierarchy factory constructor.
KernelTarget already uses IncrementalClassHierarchy, and other clients either need ClosedWorldClassHierarchy, so should explicitly create it, or don't care, and can be switched to IncrementalClassHierarchy. R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com BUG= Review-Url: https://codereview.chromium.org/2930973002 .
This commit is contained in:
parent
06c4619b3e
commit
cf59b1a0f9
|
@ -6,8 +6,8 @@ import 'package:front_end/src/fasta/type_inference/type_constraint_gatherer.dart
|
|||
import 'package:front_end/src/fasta/type_inference/type_schema.dart';
|
||||
import 'package:front_end/src/fasta/type_inference/type_schema_environment.dart';
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/class_hierarchy.dart';
|
||||
import 'package:kernel/core_types.dart';
|
||||
import 'package:kernel/src/incremental_class_hierarchy.dart';
|
||||
import 'package:kernel/testing/mock_sdk_program.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
@ -209,8 +209,8 @@ class TypeConstraintGathererTest {
|
|||
|
||||
void _checkConstraints(
|
||||
DartType a, DartType b, List<String> expectedConstraints) {
|
||||
var typeSchemaEnvironment =
|
||||
new TypeSchemaEnvironment(coreTypes, new ClassHierarchy(program), true);
|
||||
var typeSchemaEnvironment = new TypeSchemaEnvironment(
|
||||
coreTypes, new IncrementalClassHierarchy(), true);
|
||||
var typeConstraintGatherer = new TypeConstraintGatherer(
|
||||
typeSchemaEnvironment, [T1.parameter, T2.parameter]);
|
||||
var constraints = typeConstraintGatherer.trySubtypeMatch(a, b)
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
import 'package:front_end/src/fasta/type_inference/type_schema.dart';
|
||||
import 'package:front_end/src/fasta/type_inference/type_schema_environment.dart';
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/class_hierarchy.dart';
|
||||
import 'package:kernel/core_types.dart';
|
||||
import 'package:kernel/src/incremental_class_hierarchy.dart';
|
||||
import 'package:kernel/testing/mock_sdk_program.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
@ -802,7 +802,7 @@ class TypeSchemaEnvironmentTest {
|
|||
|
||||
TypeSchemaEnvironment _makeEnv() {
|
||||
return new TypeSchemaEnvironment(
|
||||
coreTypes, new ClassHierarchy(program), true);
|
||||
coreTypes, new IncrementalClassHierarchy(), true);
|
||||
}
|
||||
|
||||
DartType _map(DartType key, DartType value) =>
|
||||
|
|
|
@ -13,9 +13,6 @@ import 'type_algebra.dart';
|
|||
/// TODO(scheglov) Several methods are not used, or used only in tests.
|
||||
/// Check if these methods are not useful and should be removed .
|
||||
abstract class ClassHierarchy {
|
||||
factory ClassHierarchy(Program program) =>
|
||||
new ClosedWorldClassHierarchy(program);
|
||||
|
||||
/// Given the [unordered] classes, return them in such order that classes
|
||||
/// occur after their superclasses. If some superclasses are not in
|
||||
/// [unordered], they are not included.
|
||||
|
|
|
@ -41,7 +41,7 @@ main(List<String> args) {
|
|||
ClassHierarchy buildHierarchy() {
|
||||
return options['basic']
|
||||
? new BasicClassHierarchy(program)
|
||||
: new ClassHierarchy(program);
|
||||
: new ClosedWorldClassHierarchy(program);
|
||||
}
|
||||
|
||||
var watch = new Stopwatch()..start();
|
||||
|
|
|
@ -50,7 +50,7 @@ void main(List<String> args) {
|
|||
ClassHierarchy buildClassHierarchy() {
|
||||
return options['basic']
|
||||
? new BasicClassHierarchy(program)
|
||||
: new ClassHierarchy(program);
|
||||
: new ClosedWorldClassHierarchy(program);
|
||||
}
|
||||
|
||||
CoreTypes coreTypes = new CoreTypes(program);
|
||||
|
|
|
@ -39,7 +39,7 @@ main(List<String> args) {
|
|||
bool strongMode = options['strong'];
|
||||
|
||||
Program program = loadProgramFromBinary(filename);
|
||||
ClassHierarchy hierarchy = new ClassHierarchy(program);
|
||||
ClassHierarchy hierarchy = new ClosedWorldClassHierarchy(program);
|
||||
CoreTypes coreTypes = new CoreTypes(program);
|
||||
|
||||
int copyCount = int.parse(options['count']);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// 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.
|
||||
|
||||
import 'package:kernel/src/incremental_class_hierarchy.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:kernel/ast.dart';
|
||||
import 'package:kernel/class_hierarchy.dart';
|
||||
|
@ -171,8 +172,7 @@ MockSubtypeTester makeSubtypeTester(Map<String, List<String>> testcase) {
|
|||
}
|
||||
}
|
||||
}
|
||||
var program = new Program(libraries: [environment.dummyLibrary]);
|
||||
var hierarchy = new ClassHierarchy(program);
|
||||
var hierarchy = new IncrementalClassHierarchy();
|
||||
return new MockSubtypeTester(hierarchy, objectClass.rawType,
|
||||
functionClass.rawType, futureClass, futureOrClass, environment);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
import 'package:kernel/kernel.dart';
|
||||
import 'package:kernel/class_hierarchy.dart';
|
||||
import 'package:kernel/core_types.dart';
|
||||
import 'package:kernel/src/incremental_class_hierarchy.dart';
|
||||
import 'package:kernel/type_checker.dart';
|
||||
import 'dart:io';
|
||||
|
||||
|
@ -20,7 +21,7 @@ main(List<String> args) {
|
|||
}
|
||||
var program = loadProgramFromBinary(args[0]);
|
||||
var coreTypes = new CoreTypes(program);
|
||||
var hierarchy = new ClassHierarchy(program);
|
||||
var hierarchy = new IncrementalClassHierarchy();
|
||||
new TestTypeChecker(coreTypes, hierarchy).checkProgram(program);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue