| OLD | NEW | 
|---|
| 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 // Check that calls through fields elide the call-through stub.  This | 5 // Check that calls through fields elide the call-through stub.  This | 
| 6 // optimization is done by the simplifier, so inlining does not need to be | 6 // optimization is done by the simplifier, so inlining does not need to be | 
| 7 // enabled. | 7 // enabled. | 
| 8 | 8 | 
| 9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; | 
| 10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 32 } | 32 } | 
| 33 add1(x) => x + 1; | 33 add1(x) => x + 1; | 
| 34 main() { | 34 main() { | 
| 35   var w = new W(add1); | 35   var w = new W(add1); | 
| 36   var x = w.foo(42); | 36   var x = w.foo(42); | 
| 37 } | 37 } | 
| 38 '''; | 38 '''; | 
| 39 | 39 | 
| 40 main() { | 40 main() { | 
| 41   asyncTest(() => compileAll(TEST1).then((generated) { | 41   asyncTest(() => compileAll(TEST1).then((generated) { | 
| 42     // Direct call through field. | 42         // Direct call through field. | 
| 43     Expect.isTrue(generated.contains(r'this._fun.call$1(zzz)')); | 43         Expect.isTrue(generated.contains(r'this._fun.call$1(zzz)')); | 
| 44     // No stub. | 44         // No stub. | 
| 45     Expect.isFalse(generated.contains(r'_fun$1:')); | 45         Expect.isFalse(generated.contains(r'_fun$1:')); | 
| 46     // No call to stub. | 46         // No call to stub. | 
| 47     Expect.isFalse(generated.contains(r'_fun$1(')); | 47         Expect.isFalse(generated.contains(r'_fun$1(')); | 
| 48   })); | 48       })); | 
| 49 | 49 | 
| 50   asyncTest(() => compileAll(TEST2).then((generated) { | 50   asyncTest(() => compileAll(TEST2).then((generated) { | 
| 51     // No call through field. | 51         // No call through field. | 
| 52     Expect.isFalse(generated.contains(r'this._fun.call$1(zzz)')); | 52         Expect.isFalse(generated.contains(r'this._fun.call$1(zzz)')); | 
| 53     // Call through stub. | 53         // Call through stub. | 
| 54     Expect.isTrue(generated.contains(r'this._fun$1(zzz)')); | 54         Expect.isTrue(generated.contains(r'this._fun$1(zzz)')); | 
| 55     // Stub is generated. | 55         // Stub is generated. | 
| 56     Expect.isTrue(generated.contains(r'_fun$1:')); | 56         Expect.isTrue(generated.contains(r'_fun$1:')); | 
| 57     // Call through getter (inside stub). | 57         // Call through getter (inside stub). | 
| 58     Expect.isTrue(generated.contains(r'get$_fun().call$1')); | 58         Expect.isTrue(generated.contains(r'get$_fun().call$1')); | 
| 59   })); | 59       })); | 
| 60 } | 60 } | 
| OLD | NEW | 
|---|