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

Side by Side Diff: tests/compiler/dart2js/call_site_type_inferer_static_test.dart

Issue 10871071: - Change "static final" to "static const" in the tests/ directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #import("dart:uri"); 5 #import("dart:uri");
6 6
7 #import("../../../lib/compiler/implementation/ssa/ssa.dart"); 7 #import("../../../lib/compiler/implementation/ssa/ssa.dart");
8 8
9 #import('compiler_helper.dart'); 9 #import('compiler_helper.dart');
10 #import('parser_helper.dart'); 10 #import('parser_helper.dart');
11 11
12 void compileAndFind(String code, 12 void compileAndFind(String code,
13 String functionName, 13 String functionName,
14 check(compiler, element)) { 14 check(compiler, element)) {
15 Uri uri = new Uri.fromComponents(scheme: 'source'); 15 Uri uri = new Uri.fromComponents(scheme: 'source');
16 var compiler = compilerFor(code, uri); 16 var compiler = compilerFor(code, uri);
17 compiler.runCompiler(uri); 17 compiler.runCompiler(uri);
18 var fun = findElement(compiler, functionName); 18 var fun = findElement(compiler, functionName);
19 return check(compiler.backend, fun); 19 return check(compiler.backend, fun);
20 } 20 }
21 21
22 // The 'f' function has an 'if' to make it non-inlinable. 22 // The 'f' function has an 'if' to make it non-inlinable.
23 final String TEST_ONE = @""" 23 const String TEST_ONE = @"""
24 f(p) { if (p == null) return p; return p; } 24 f(p) { if (p == null) return p; return p; }
25 main() { f("s"); } 25 main() { f("s"); }
26 """; 26 """;
27 27
28 final String TEST_TWO = @""" 28 const String TEST_TWO = @"""
29 f(p) { if (p == null) return p; return p; } 29 f(p) { if (p == null) return p; return p; }
30 main() { f(1); } 30 main() { f(1); }
31 """; 31 """;
32 32
33 final String TEST_THREE = @""" 33 const String TEST_THREE = @"""
34 f(p) { if (p == null) return p; return p; } 34 f(p) { if (p == null) return p; return p; }
35 main() { f(1); f(2); } 35 main() { f(1); f(2); }
36 """; 36 """;
37 37
38 final String TEST_FOUR = @""" 38 const String TEST_FOUR = @"""
39 f(p) { if (p == null) return p; return p; } 39 f(p) { if (p == null) return p; return p; }
40 main() { f(1.1); } 40 main() { f(1.1); }
41 """; 41 """;
42 42
43 final String TEST_FIVE = @""" 43 const String TEST_FIVE = @"""
44 f(p) { if (p == null) return p; return p; } 44 f(p) { if (p == null) return p; return p; }
45 main() { f(1); f(2.2); } 45 main() { f(1); f(2.2); }
46 """; 46 """;
47 47
48 final String TEST_SIX = @""" 48 const String TEST_SIX = @"""
49 f(p) { if (p == null) return p; return p; } 49 f(p) { if (p == null) return p; return p; }
50 main() { f(1.1); f(2); } 50 main() { f(1.1); f(2); }
51 """; 51 """;
52 52
53 final String TEST_SEVEN = @""" 53 const String TEST_SEVEN = @"""
54 f(p) { if (p == null) return p; return p; } 54 f(p) { if (p == null) return p; return p; }
55 main() { f(1); f("s"); } 55 main() { f(1); f("s"); }
56 """; 56 """;
57 57
58 final String TEST_EIGHT = @""" 58 const String TEST_EIGHT = @"""
59 f(p1, p2) { if (p1 == null) return p1; return p2; } 59 f(p1, p2) { if (p1 == null) return p1; return p2; }
60 main() { f(1, 2); f(1, "s"); } 60 main() { f(1, 2); f(1, "s"); }
61 """; 61 """;
62 62
63 final String TEST_NINE = @""" 63 const String TEST_NINE = @"""
64 f(p1, p2) { if (p1 == null) return p1; return p2; } 64 f(p1, p2) { if (p1 == null) return p1; return p2; }
65 main() { f("s", 2); f(1, "s"); } 65 main() { f("s", 2); f(1, "s"); }
66 """; 66 """;
67 67
68 final String TEST_TEN = @""" 68 const String TEST_TEN = @"""
69 f(p) { if (p == null) return p; return p; } 69 f(p) { if (p == null) return p; return p; }
70 g(p) { if (p== null) return null; return p(1); } 70 g(p) { if (p== null) return null; return p(1); }
71 main() { f(1); g(f); } 71 main() { f(1); g(f); }
72 """; 72 """;
73 73
74 void runTest(String test, [List<HType> expectedTypes = null]) { 74 void runTest(String test, [List<HType> expectedTypes = null]) {
75 compileAndFind( 75 compileAndFind(
76 test, 76 test,
77 'f', 77 'f',
78 (backend, x) { 78 (backend, x) {
(...skipping 16 matching lines...) Expand all
95 runTest(TEST_SIX, [HType.NUMBER]); 95 runTest(TEST_SIX, [HType.NUMBER]);
96 runTest(TEST_SEVEN); 96 runTest(TEST_SEVEN);
97 runTest(TEST_EIGHT, [HType.INTEGER, HType.UNKNOWN]); 97 runTest(TEST_EIGHT, [HType.INTEGER, HType.UNKNOWN]);
98 runTest(TEST_NINE); 98 runTest(TEST_NINE);
99 runTest(TEST_TEN); 99 runTest(TEST_TEN);
100 } 100 }
101 101
102 void main() { 102 void main() {
103 test(); 103 test();
104 } 104 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/builtin_interceptor_test.dart ('k') | tests/compiler/dart2js/call_site_type_inferer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698