| 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 // Regression test for dart2js code generation in checked mode. See | 5 // Regression test for dart2js code generation in checked mode. See |
| 6 // last part of https://code.google.com/p/dart/issues/detail?id=9687. | 6 // last part of https://code.google.com/p/dart/issues/detail?id=9687. |
| 7 | 7 |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 | 9 |
| 10 class A { | 10 class A { |
| 11 final finalField; | 11 final finalField; |
| 12 final otherFinalField; | 12 final otherFinalField; |
| 13 | 13 |
| 14 A() : finalField = 42, otherFinalField = 54; | 14 A() |
| 15 : finalField = 42, |
| 16 otherFinalField = 54; |
| 15 | 17 |
| 16 expectFinalField(arg1, arg2) { | 18 expectFinalField(arg1, arg2) { |
| 17 Expect.equals(arg1, arg2); | 19 Expect.equals(arg1, arg2); |
| 18 Expect.equals(finalField, arg1); | 20 Expect.equals(finalField, arg1); |
| 19 } | 21 } |
| 20 | 22 |
| 21 expectOtherFinalField(_, arg1, arg2) { | 23 expectOtherFinalField(_, arg1, arg2) { |
| 22 Expect.equals(arg1, arg2); | 24 Expect.equals(arg1, arg2); |
| 23 Expect.equals(otherFinalField, arg1); | 25 Expect.equals(otherFinalField, arg1); |
| 24 } | 26 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 // Having a check instruction in between two allocations of | 44 // Having a check instruction in between two allocations of |
| 43 // temporary variables used to trigger a bug in the compiler. | 45 // temporary variables used to trigger a bug in the compiler. |
| 44 int b = a; | 46 int b = a; |
| 45 | 47 |
| 46 // Using [: otherFinalField :] twice will make the compiler want to | 48 // Using [: otherFinalField :] twice will make the compiler want to |
| 47 // allocate one temporary for it. The compiler used to assign the | 49 // allocate one temporary for it. The compiler used to assign the |
| 48 // same temporary for [: otherFinalField :] and [: finalField :]. | 50 // same temporary for [: otherFinalField :] and [: finalField :]. |
| 49 untypedReceiver.expectOtherFinalField( | 51 untypedReceiver.expectOtherFinalField( |
| 50 b, typedReceiver.otherFinalField, typedReceiver.otherFinalField); | 52 b, typedReceiver.otherFinalField, typedReceiver.otherFinalField); |
| 51 } | 53 } |
| OLD | NEW |