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

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

Issue 2331923002: Handle signature types and fields in kernel_impact (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/universe/feature.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
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 dart2js.kernel.impact_test; 5 library dart2js.kernel.impact_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/src/common.dart'; 9 import 'package:compiler/src/common.dart';
10 import 'package:compiler/src/commandline_options.dart'; 10 import 'package:compiler/src/commandline_options.dart';
(...skipping 23 matching lines...) Expand all
34 testNonEmptyListLiteral(); 34 testNonEmptyListLiteral();
35 testEmptyMapLiteral(); 35 testEmptyMapLiteral();
36 testEmptyMapLiteralDynamic(); 36 testEmptyMapLiteralDynamic();
37 testEmptyMapLiteralTyped(); 37 testEmptyMapLiteralTyped();
38 testEmptyMapLiteralConstant(); 38 testEmptyMapLiteralConstant();
39 testNonEmptyMapLiteral(); 39 testNonEmptyMapLiteral();
40 testNot(); 40 testNot();
41 testUnaryMinus(); 41 testUnaryMinus();
42 testIfThen(); 42 testIfThen();
43 testIfThenElse(); 43 testIfThenElse();
44 testTopLevelInvoke();
45 testTopLevelInvokeTyped();
46 testTopLevelField();
47 testTopLevelFieldTyped();
44 } 48 }
45 49
46 testEmpty() {} 50 testEmpty() {}
47 testNull() => null; 51 testNull() => null;
48 testTrue() => true; 52 testTrue() => true;
49 testFalse() => false; 53 testFalse() => false;
50 testInt() => 42; 54 testInt() => 42;
51 testDouble() => 37.5; 55 testDouble() => 37.5;
52 testString() => 'foo'; 56 testString() => 'foo';
53 testSymbol() => #main; 57 testSymbol() => #main;
(...skipping 13 matching lines...) Expand all
67 if (false) return 42; 71 if (false) return 42;
68 return 1; 72 return 1;
69 } 73 }
70 testIfThenElse() { 74 testIfThenElse() {
71 if (true) { 75 if (true) {
72 return 42; 76 return 42;
73 } else { 77 } else {
74 return 1; 78 return 1;
75 } 79 }
76 } 80 }
81 topLevelFunction1(a) {}
82 topLevelFunction2(a, [b, c]) {}
83 topLevelFunction3(a, {b, c}) {}
84 testTopLevelInvoke() {
85 topLevelFunction1(0);
86 topLevelFunction2(1);
87 topLevelFunction2(2, 3);
88 topLevelFunction2(4, 5, 6);
89 topLevelFunction3(7);
90 topLevelFunction3(8, b: 9);
91 topLevelFunction3(10, c: 11);
92 topLevelFunction3(12, b: 13, c: 14);
93 topLevelFunction3(15, c: 16, b: 17);
94 }
95 void topLevelFunction1Typed(int a) {}
96 int topLevelFunction2Typed(String a, [num b, double c]) => null;
97 double topLevelFunction3Typed(bool a, {List<int> b, Map<String, bool> c}) {
98 return null;
99 }
100 testTopLevelInvokeTyped() {
101 topLevelFunction1Typed(0);
102 topLevelFunction2Typed('1');
103 topLevelFunction2Typed('2', 3);
104 topLevelFunction2Typed('3', 5, 6.0);
105 topLevelFunction3Typed(true);
106 topLevelFunction3Typed(false, b: []);
107 topLevelFunction3Typed(null, c: {});
108 topLevelFunction3Typed(true, b: [13], c: {'14': true});
109 topLevelFunction3Typed(false, c: {'16': false}, b: [17]);
110 }
111 var topLevelField;
112 testTopLevelField() => topLevelField;
113 int topLevelFieldTyped;
114 testTopLevelFieldTyped() => topLevelFieldTyped;
77 ''' 115 '''
78 }; 116 };
79 117
80 main(List<String> args) { 118 main(List<String> args) {
81 asyncTest(() async { 119 asyncTest(() async {
82 enableDebugMode(); 120 enableDebugMode();
83 Uri entryPoint = Uri.parse('memory:main.dart'); 121 Uri entryPoint = Uri.parse('memory:main.dart');
84 Compiler compiler = compilerFor( 122 Compiler compiler = compilerFor(
85 entryPoint: entryPoint, 123 entryPoint: entryPoint,
86 memorySourceFiles: SOURCE, 124 memorySourceFiles: SOURCE,
87 options: [Flags.analyzeOnly, Flags.useKernel]); 125 options: [Flags.analyzeOnly, Flags.useKernel]);
88 compiler.resolution.retainCachesForTesting = true; 126 compiler.resolution.retainCachesForTesting = true;
89 await compiler.run(entryPoint); 127 await compiler.run(entryPoint);
90 compiler.mainApp 128 compiler.mainApp
91 .forEachLocalMember((element) => checkElement(compiler, element)); 129 .forEachLocalMember((element) => checkElement(compiler, element));
92 }); 130 });
93 } 131 }
94 132
95 void checkElement(Compiler compiler, AstElement element) { 133 void checkElement(Compiler compiler, AstElement element) {
96 ResolutionImpact astImpact = compiler.resolution.getResolutionImpact(element); 134 ResolutionImpact astImpact = compiler.resolution.getResolutionImpact(element);
97 ResolutionImpact kernelImpact = build(compiler, element.resolvedAst); 135 ResolutionImpact kernelImpact = build(compiler, element.resolvedAst);
98 testResolutionImpactEquivalence( 136 testResolutionImpactEquivalence(
99 astImpact, kernelImpact, const CheckStrategy()); 137 astImpact, kernelImpact, const CheckStrategy());
100 } 138 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/universe/feature.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698