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

Side by Side Diff: tests/compiler/dart2js/kernel/class_hierarchy_test.dart

Issue 2942763002: Late night strong mode cleaning. (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 /// Test that the dart2js copy of [KernelVisitor] generates the expected class 5 /// Test that the dart2js copy of [KernelVisitor] generates the expected class
6 /// hierarchy. 6 /// hierarchy.
7 7
8 import 'package:compiler/src/commandline_options.dart' show Flags; 8 import 'package:compiler/src/commandline_options.dart' show Flags;
9 import 'package:compiler/src/compiler.dart' show Compiler; 9 import 'package:compiler/src/compiler.dart' show Compiler;
10 import 'package:compiler/src/elements/elements.dart';
11 import 'package:compiler/src/js_backend/backend.dart' show JavaScriptBackend; 10 import 'package:compiler/src/js_backend/backend.dart' show JavaScriptBackend;
12 import 'package:compiler/src/library_loader.dart' show LoadedLibraries; 11 import 'package:compiler/src/library_loader.dart' show LoadedLibraries;
13 import 'package:kernel/ast.dart' as ir; 12 import 'package:kernel/ast.dart' as ir;
14 import 'package:kernel/class_hierarchy.dart'; 13 import 'package:kernel/class_hierarchy.dart';
15 import 'package:test/test.dart'; 14 import 'package:test/test.dart';
16 15
17 import '../memory_compiler.dart'; 16 import '../memory_compiler.dart';
18 17
19 main(List<String> arguments) { 18 main(List<String> arguments) {
20 Compiler compiler = compilerFor(memorySourceFiles: { 19 Compiler compiler = compilerFor(memorySourceFiles: {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 print('$cls'); 52 print('$cls');
54 print(' dispatch targets:'); 53 print(' dispatch targets:');
55 hierarchy 54 hierarchy
56 .getDispatchTargets(cls) 55 .getDispatchTargets(cls)
57 .forEach((member) => print(' $member')); 56 .forEach((member) => print(' $member'));
58 } 57 }
59 return cls; 58 return cls;
60 } 59 }
61 } 60 }
62 fail('Class $name not found.'); 61 fail('Class $name not found.');
62 throw "Not reachable.";
63 } 63 }
64 64
65 ir.Class classS = getClass('S'); 65 ir.Class classS = getClass('S');
66 ir.Class classM = getClass('M'); 66 ir.Class classM = getClass('M');
67 ir.Class classC = getClass('C'); 67 ir.Class classC = getClass('C');
68 68
69 void checkInheritance(ir.Class superClass, ir.Class subClass) { 69 void checkInheritance(ir.Class superClass, ir.Class subClass) {
70 for (ir.Member member in hierarchy.getDispatchTargets(superClass)) { 70 for (ir.Member member in hierarchy.getDispatchTargets(superClass)) {
71 expect( 71 expect(
72 hierarchy.getDispatchTarget(subClass, member.name), equals(member), 72 hierarchy.getDispatchTarget(subClass, member.name), equals(member),
73 reason: 'Unexpected dispatch target for ${member.name} ' 73 reason: 'Unexpected dispatch target for ${member.name} '
74 'in $subClass'); 74 'in $subClass');
75 } 75 }
76 } 76 }
77 77
78 checkInheritance(classS, classC); 78 checkInheritance(classS, classC);
79 checkInheritance(classM, classC); 79 checkInheritance(classM, classC);
80 }); 80 });
81 } 81 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/inference/id_equivalence_test.dart ('k') | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698