Chromium Code Reviews| Index: tests/language/constant_string_interpolation.dart |
| =================================================================== |
| --- tests/language/constant_string_interpolation.dart (revision 0) |
| +++ tests/language/constant_string_interpolation.dart (working copy) |
| @@ -0,0 +1,32 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
|
Florian Schneider
2013/10/23 17:32:39
Can you check if test.py runs this test? At some p
Emily Fortuna
2013/10/23 17:35:08
You're right. test.py won't identify this as a tes
srdjan
2013/10/23 20:39:02
Thanks, renamed appropriately and checked that it
|
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| +// VMOptions=--optimization-counter-threshold=10 --no-use-osr |
| + |
| +import "package:expect/expect.dart"; |
| + |
| +main() { |
| + final a = new A(); |
| + for (int i = 0; i < 20; i++) { |
| + final r = interpolIt(a); |
| + Expect.stringEquals("hello home", r); |
| + } |
| + final b = new B(); |
| + // Deoptimize "interpolIt". |
| + final r = interpolIt(b); |
| + Expect.stringEquals("hello world", r); |
| +} |
| + |
| + |
| +String interpolIt(v) { |
| + // String interpolation will be constant folded. |
| + return "hello ${v.foo()}"; |
| +} |
| + |
| +class A { |
| + foo() => "home"; |
| +} |
| + |
| +class B { |
| + foo() => "world"; |
| +} |