OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 'compiler_helper.dart'; | 6 import 'compiler_helper.dart'; |
6 | 7 |
7 const String TEST_ONE = r""" | 8 const String TEST_ONE = r""" |
8 foo(a) { | 9 foo(a) { |
9 // Make sure there is a bailout version. | 10 // Make sure there is a bailout version. |
10 foo(a); | 11 foo(a); |
11 // This will make a one shot interceptor that will be optimized in | 12 // This will make a one shot interceptor that will be optimized in |
12 // the non-bailout version because we know a is a number. | 13 // the non-bailout version because we know a is a number. |
13 return (a + 42).toString; | 14 return (a + 42).toString; |
14 } | 15 } |
(...skipping 30 matching lines...) Expand all Loading... |
45 Expect.isTrue(generated.contains('myVariableName')); | 46 Expect.isTrue(generated.contains('myVariableName')); |
46 | 47 |
47 // Check that an intercepted getter that does not need to be | 48 // Check that an intercepted getter that does not need to be |
48 // intercepted, is turned into a regular getter call or field | 49 // intercepted, is turned into a regular getter call or field |
49 // access. | 50 // access. |
50 generated = compile(TEST_THREE, entry: 'foo'); | 51 generated = compile(TEST_THREE, entry: 'foo'); |
51 Expect.isFalse(generated.contains(r'get$length')); | 52 Expect.isFalse(generated.contains(r'get$length')); |
52 Expect.isTrue(generated.contains(r'$.A$().length')); | 53 Expect.isTrue(generated.contains(r'$.A$().length')); |
53 Expect.isTrue(generated.contains(r'length(a)')); | 54 Expect.isTrue(generated.contains(r'length(a)')); |
54 } | 55 } |
OLD | NEW |