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

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

Issue 2323733002: Compute ResolutionImpact directly from kernel, part 1 of ? (Closed)
Patch Set: Updated cf. comments. Created 4 years, 3 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_impact.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library dart2js.kernel.impact_test;
6
7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/src/common.dart';
10 import 'package:compiler/src/commandline_options.dart';
11 import 'package:compiler/src/common/resolution.dart';
12 import 'package:compiler/src/compiler.dart';
13 import 'package:compiler/src/elements/elements.dart';
14 import 'package:compiler/src/ssa/kernel_impact.dart';
15 import 'package:compiler/src/serialization/equivalence.dart';
16 import '../memory_compiler.dart';
17 import '../serialization/test_helper.dart';
18
19 const Map<String, String> SOURCE = const <String, String>{
20 'main.dart': '''
21 main() {
22 testEmpty();
23 testNull();
24 testTrue();
25 testFalse();
26 testInt();
27 testDouble();
28 testString();
29 testSymbol();
30 testEmptyListLiteral();
31 testEmptyListLiteralDynamic();
32 testEmptyListLiteralTyped();
33 testEmptyListLiteralConstant();
34 testNonEmptyListLiteral();
35 testEmptyMapLiteral();
36 testEmptyMapLiteralDynamic();
37 testEmptyMapLiteralTyped();
38 testEmptyMapLiteralConstant();
39 testNonEmptyMapLiteral();
40 testNot();
41 testUnaryMinus();
42 testIfThen();
43 testIfThenElse();
44 }
45
46 testEmpty() {}
47 testNull() => null;
48 testTrue() => true;
49 testFalse() => false;
50 testInt() => 42;
51 testDouble() => 37.5;
52 testString() => 'foo';
53 testSymbol() => #main;
54 testEmptyListLiteral() => [];
55 testEmptyListLiteralDynamic() => <dynamic>[];
56 testEmptyListLiteralTyped() => <String>[];
57 testEmptyListLiteralConstant() => const [];
58 testNonEmptyListLiteral() => [0];
59 testEmptyMapLiteral() => {};
60 testEmptyMapLiteralDynamic() => <dynamic, dynamic>{};
61 testEmptyMapLiteralTyped() => <String, int>{};
62 testEmptyMapLiteralConstant() => const {};
63 testNonEmptyMapLiteral() => {0: true};
64 testNot() => !false;
65 testUnaryMinus() => -1;
66 testIfThen() {
67 if (false) return 42;
68 return 1;
69 }
70 testIfThenElse() {
71 if (true) {
72 return 42;
73 } else {
74 return 1;
75 }
76 }
77 '''
78 };
79
80 main(List<String> args) {
81 asyncTest(() async {
82 enableDebugMode();
83 Uri entryPoint = Uri.parse('memory:main.dart');
84 Compiler compiler = compilerFor(
85 entryPoint: entryPoint,
86 memorySourceFiles: SOURCE,
87 options: [Flags.analyzeOnly]);
88 compiler.resolution.retainCachesForTesting = true;
89 await compiler.run(entryPoint);
90 compiler.mainApp.forEachLocalMember(
91 (element) => checkElement(compiler, element));
92 });
93 }
94
95 void checkElement(Compiler compiler, AstElement element) {
96 ResolutionImpact astImpact =
97 compiler.resolution.getResolutionImpact(element);
98 ResolutionImpact kernelImpact = build(compiler, element.resolvedAst);
99 testResolutionImpactEquivalence(astImpact, kernelImpact,
100 const CheckStrategy());
101 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_impact.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698