Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Dart test program for constructors and initializers. | 4 // Dart test program for constructors and initializers. |
| 5 | 5 |
| 6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
| 7 | 7 |
| 8 // Expect the initializer expressions E(i) to be evaluated | 8 // Expect the initializer expressions E(i) to be evaluated |
| 9 // in the order 1, 2, 3, ... | 9 // in the order 1, 2, 3, ... |
| 10 // This test has no inheritance but many fields to flush out issues with | 10 // This test has no inheritance but many fields to flush out issues with |
| 11 // ordering of fields. | 11 // ordering of fields. |
| 12 | 12 |
| 13 String trace = ""; | 13 String trace = ""; |
| 14 | 14 |
| 15 int E(int i) { | 15 int E(int i) { |
| 16 trace += "$i-"; | 16 trace += "$i-"; |
| 17 return i; | 17 return i; |
| 18 } | 18 } |
| 19 | 19 |
| 20 class A { | 20 class A { |
| 21 var j; // Names are in reverse order to detect sorting by name... | 21 var j; // Names are in reverse order to detect sorting by name... |
| 22 var i = 0; // Initialized odd/even to detect these inits affecting order. | 22 var i = 0; // Initialized odd/even to detect these inits affecting order. |
|
sra1
2017/03/21 03:28:14
fix
| |
| 23 var h; | 23 var h; |
| 24 var g = 0; | 24 var g = 0; |
| 25 var f; | 25 var f; |
| 26 var e = 0; | 26 var e = 0; |
| 27 var d; | 27 var d; |
| 28 var c = 0; | 28 var c = 0; |
| 29 var b; | 29 var b; |
| 30 var a = 0; | 30 var a = 0; |
| 31 | 31 |
| 32 A() | 32 A() |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 55 Expect.equals(8, h); | 55 Expect.equals(8, h); |
| 56 Expect.equals(9, i); | 56 Expect.equals(9, i); |
| 57 Expect.equals(10, j); | 57 Expect.equals(10, j); |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 main() { | 61 main() { |
| 62 var x = new A(); | 62 var x = new A(); |
| 63 Expect.equals('1-2-3-4-5-6-7-8-9-10-', trace); | 63 Expect.equals('1-2-3-4-5-6-7-8-9-10-', trace); |
| 64 } | 64 } |
| OLD | NEW |