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

Unified Diff: tests/compiler/dart2js/call_site_type_inferer_static_test.dart

Issue 10855170: Track types for arguments passed to calls to static functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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/call_site_type_inferer_static_test.dart
diff --git a/tests/compiler/dart2js/call_site_type_inferer_test.dart b/tests/compiler/dart2js/call_site_type_inferer_static_test.dart
similarity index 57%
copy from tests/compiler/dart2js/call_site_type_inferer_test.dart
copy to tests/compiler/dart2js/call_site_type_inferer_static_test.dart
index eb8ff00a8c92340a1faf8196e35874d8cc159ef7..3a3a7dd85915788b740f4368b19b576e9d6d58f5 100644
--- a/tests/compiler/dart2js/call_site_type_inferer_test.dart
+++ b/tests/compiler/dart2js/call_site_type_inferer_static_test.dart
@@ -10,119 +10,70 @@
#import('parser_helper.dart');
void compileAndFind(String code,
- String className,
- String memberName,
+ String functionName,
check(compiler, element)) {
Uri uri = new Uri.fromComponents(scheme: 'source');
var compiler = compilerFor(code, uri);
compiler.runCompiler(uri);
- var cls = findElement(compiler, className);
- var member = cls.lookupLocalMember(buildSourceString(memberName));
- return check(compiler.backend, member);
+ var fun = findElement(compiler, functionName);
+ return check(compiler.backend, fun);
}
final String TEST_ONE = @"""
- class A {
- x(p) => p;
- }
- main() { new A().x("s"); }
+ f(p) => p;
+ main() { f("s"); }
""";
final String TEST_TWO = @"""
- class A {
- x(p) => p;
- }
- main() { new A().x(1); }
+ f(p) => p;
+ main() { f(1); }
""";
final String TEST_THREE = @"""
- class A {
- x(p) => x(p - 1);
- }
- main() { new A().x(1); }
+ f(p) => p;
+ main() { f(1); f(2); }
""";
final String TEST_FOUR = @"""
- class A {
- x(p) => x(p - 1);
- }
- main() { new A().x(1.0); }
+ f(p) => p;
+ main() { f(1.1); }
""";
final String TEST_FIVE = @"""
- class A {
- x(p) => p;
- }
- main() {
- new A().x(1);
- new A().x(1.0);
- }
+ f(p) => p;
+ main() { f(1); f(2.2); }
""";
final String TEST_SIX = @"""
- class A {
- x(p) => p;
- }
- main() {
- new A().x(1.0);
- new A().x(1);
- }
+ f(p) => p;
+ main() { f(1.1); f(2); }
""";
final String TEST_SEVEN = @"""
- class A {
- x(p) => x("x");
- }
- main() {
- new A().x(1);
- }
+ f(p) => p;
+ main() { f(1); f("s"); }
""";
final String TEST_EIGHT = @"""
- class A {
- x(p1, p2) => x(p1, "x");
- }
- main() {
- new A().x(1, 2);
- }
+ f(p1, p2) => p1;
+ main() { f(1, 2); f(1, "s"); }
""";
final String TEST_NINE = @"""
- class A {
- x(p1, p2) => x(p1, p2);
- }
- main() {
- new A().x(1, 2);
- }
+ f(p1, p2) => p1;
+ main() { f("s", 2); f(1, "s"); }
""";
final String TEST_TEN = @"""
- class A {
- x(p1, p2) => x(p1, p2);
- }
- void f(p) {
- p.x("x", "y");
- }
- main() {
- f(null);
- new A().x(1, 2);
- }
-""";
-
-final String TEST_ELEVEN = @"""
- class A {
- x(p1, p2) => x(1, 2);
- }
- main() {
- new A().x("x", "y");
- }
+ f(p) => p;
+ g(p) => p(1);
+ main() { f(1); g(f); }
""";
void runTest(String test, [List<HType> expectedTypes = null]) {
compileAndFind(
test,
- 'A',
- 'x',
+ 'f',
(backend, x) {
List<HType> types =
backend.optimisticParameterTypesWithRecompilationOnTypeChange(x);
@@ -143,9 +94,8 @@ void test() {
runTest(TEST_SIX, [HType.NUMBER]);
runTest(TEST_SEVEN);
runTest(TEST_EIGHT, [HType.INTEGER, HType.UNKNOWN]);
- runTest(TEST_NINE, [HType.INTEGER, HType.INTEGER]);
+ runTest(TEST_NINE);
runTest(TEST_TEN);
- runTest(TEST_ELEVEN);
}
void main() {
« lib/compiler/implementation/ssa/optimize.dart ('K') | « tests/co19/co19-leg.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698