OLD | NEW |
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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import "../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend
.dart"; | 6 import "../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend
.dart"; |
7 import "../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart"; | 7 import "../../../sdk/lib/_internal/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 bool disableInlining, | 14 bool disableInlining, |
15 check(compiler, element)) { | 15 check(compiler, element)) { |
16 Uri uri = new Uri.fromComponents(scheme: 'source'); | 16 Uri uri = new Uri(scheme: 'source'); |
17 var compiler = compilerFor(code, uri); | 17 var compiler = compilerFor(code, uri); |
18 compiler.disableInlining = disableInlining; | 18 compiler.disableInlining = disableInlining; |
19 compiler.runCompiler(uri); | 19 compiler.runCompiler(uri); |
20 var fun = findElement(compiler, functionName); | 20 var fun = findElement(compiler, functionName); |
21 return check(compiler, fun); | 21 return check(compiler, fun); |
22 } | 22 } |
23 | 23 |
24 // The 'f' function has an 'if' to make it non-inlinable. | 24 // The 'f' function has an 'if' to make it non-inlinable. |
25 const String TEST_ONE = r""" | 25 const String TEST_ONE = r""" |
26 f(p) { if (p == null) return p; return p; } | 26 f(p) { if (p == null) return p; return p; } |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 runTest(TEST_SIX, [(compiler) => HType.NUMBER]); | 110 runTest(TEST_SIX, [(compiler) => HType.NUMBER]); |
111 runTest(TEST_SEVEN, [subclassOfInterceptor]); | 111 runTest(TEST_SEVEN, [subclassOfInterceptor]); |
112 runTest(TEST_EIGHT, [(compiler) => HType.INTEGER, subclassOfInterceptor]); | 112 runTest(TEST_EIGHT, [(compiler) => HType.INTEGER, subclassOfInterceptor]); |
113 runTest(TEST_NINE, [subclassOfInterceptor, subclassOfInterceptor]); | 113 runTest(TEST_NINE, [subclassOfInterceptor, subclassOfInterceptor]); |
114 runTest(TEST_TEN); | 114 runTest(TEST_TEN); |
115 } | 115 } |
116 | 116 |
117 void main() { | 117 void main() { |
118 test(); | 118 test(); |
119 } | 119 } |
OLD | NEW |