| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library lib1; | 5 library lib1; |
| 6 | 6 |
| 7 class ConstClass { | 7 class ConstClass { |
| 8 final x; | 8 final x; |
| 9 const ConstClass(this.x); | 9 const ConstClass(this.x); |
| 10 } | 10 } |
| 11 | 11 |
| 12 var x = const ConstClass(const ConstClass(1)); | 12 var x = const ConstClass(const ConstClass(1)); |
| 13 | 13 |
| 14 class C { | 14 class C { |
| 15 static foo() { | 15 static foo() { |
| 16 () {} (); // Hack to avoid inlining. | 16 () {}(); // Hack to avoid inlining. |
| 17 return 1; | 17 return 1; |
| 18 } | 18 } |
| 19 |
| 19 bar() { | 20 bar() { |
| 20 () {} (); // Hack to avoid inlining. | 21 () {}(); // Hack to avoid inlining. |
| 21 return 1; | 22 return 1; |
| 22 } | 23 } |
| 23 } | 24 } |
| 24 | 25 |
| 25 class C1 { | 26 class C1 { |
| 26 static var foo = const {}; | 27 static var foo = const {}; |
| 27 var bar = const {}; | 28 var bar = const {}; |
| 28 } | 29 } |
| 29 | 30 |
| 30 class C2 { | 31 class C2 { |
| 31 static var foo = new Map.from({1: 2}); | 32 static var foo = new Map.from({1: 2}); |
| 32 var bar = new Map.from({1: 2}); | 33 var bar = new Map.from({1: 2}); |
| 33 } | 34 } |
| 34 | 35 |
| 35 class C3 { | 36 class C3 { |
| 36 static final foo = const ConstClass(const ConstClass(1)); | 37 static final foo = const ConstClass(const ConstClass(1)); |
| 37 final bar = const ConstClass(const ConstClass(1)); | 38 final bar = const ConstClass(const ConstClass(1)); |
| 38 } | 39 } |
| 39 | 40 |
| 40 class C4 { | 41 class C4 { |
| 41 static final foo = new Map.from({x: x}); | 42 static final foo = new Map.from({x: x}); |
| 42 final bar = new Map.from({x: x}); | 43 final bar = new Map.from({x: x}); |
| 43 } | 44 } |
| 44 | 45 |
| 45 class C5 { | 46 class C5 { |
| 46 static const foo = const [const {1: 3}]; | 47 static const foo = const [ |
| 48 const {1: 3} |
| 49 ]; |
| 47 bar() { | 50 bar() { |
| 48 () {} (); // Hack to avoid inlining. | 51 () {}(); // Hack to avoid inlining. |
| 49 return 1; | 52 return 1; |
| 50 } | 53 } |
| 51 } | 54 } |
| OLD | NEW |