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

Unified Diff: tests/compiler/dart2js/kernel/class_hierarchy_test.dart

Issue 2997413002: Support --use-kernel in memory_compiler (Closed)
Patch Set: Remove hack in source_loader Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: tests/compiler/dart2js/kernel/class_hierarchy_test.dart
diff --git a/tests/compiler/dart2js/kernel/class_hierarchy_test.dart b/tests/compiler/dart2js/kernel/class_hierarchy_test.dart
deleted file mode 100644
index c7e7a9c5fc4f052603a1992135b8f4463db6fe79..0000000000000000000000000000000000000000
--- a/tests/compiler/dart2js/kernel/class_hierarchy_test.dart
+++ /dev/null
@@ -1,81 +0,0 @@
-// 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.
-
-/// Test that the dart2js copy of [KernelVisitor] generates the expected class
-/// hierarchy.
-
-import 'package:compiler/src/commandline_options.dart' show Flags;
-import 'package:compiler/src/compiler.dart' show Compiler;
-import 'package:compiler/src/js_backend/backend.dart' show JavaScriptBackend;
-import 'package:compiler/src/library_loader.dart' show LoadedLibraries;
-import 'package:kernel/ast.dart' as ir;
-import 'package:kernel/class_hierarchy.dart';
-import 'package:test/test.dart';
-
-import '../memory_compiler.dart';
-
-main(List<String> arguments) {
- Compiler compiler = compilerFor(memorySourceFiles: {
- 'main.dart': '''
- class S {
- sMethod() {}
- }
- class M {
- mMethod() {}
- }
- class C extends S with M {
- cMethod() {}
- }
- main() {}
- '''
- }, options: [
- Flags.analyzeOnly,
- Flags.analyzeAll,
- Flags.useKernelInSsa
- ]);
- test('mixin', () async {
- Uri mainUri = Uri.parse('memory:main.dart');
- await compiler.run(mainUri);
- LoadedLibraries libraries =
- await compiler.libraryLoader.loadLibrary(mainUri);
- compiler.processLoadedLibraries(libraries);
- JavaScriptBackend backend = compiler.backend;
- ir.Program program = backend.kernelTask.buildProgram(libraries.rootLibrary);
- ClosedWorldClassHierarchy hierarchy =
- new ClosedWorldClassHierarchy(program);
-
- ir.Class getClass(String name) {
- for (ir.Class cls in hierarchy.classes) {
- if (cls.enclosingLibrary.importUri == mainUri && cls.name == name) {
- if (arguments.contains('-v')) {
- print('$cls');
- print(' dispatch targets:');
- hierarchy
- .getDispatchTargets(cls)
- .forEach((member) => print(' $member'));
- }
- return cls;
- }
- }
- fail('Class $name not found.');
- throw "Not reachable.";
- }
-
- ir.Class classS = getClass('S');
- ir.Class classM = getClass('M');
- ir.Class classC = getClass('C');
-
- void checkInheritance(ir.Class superClass, ir.Class subClass) {
- for (ir.Member member in hierarchy.getDispatchTargets(superClass)) {
- expect(
- hierarchy.getDispatchTarget(subClass, member.name), equals(member),
- reason: 'Unexpected dispatch target for ${member.name} '
- 'in $subClass');
- }
- }
-
- checkInheritance(classS, classC);
- checkInheritance(classM, classC);
- });
-}
« no previous file with comments | « tests/compiler/dart2js/kernel/assert_test.dart ('k') | tests/compiler/dart2js/kernel/constructors_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698