| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 class A { | |
| 6 var x; | |
| 7 } | |
| 8 | |
| 9 void test_closure_with_mutate() { | |
| 10 var a = new A(); | |
| 11 a.x = () { | |
| 12 print("hi"); | |
| 13 a = null; | |
| 14 }; | |
| 15 a | |
| 16 ..x() | |
| 17 ..x(); | |
| 18 print(a); | |
| 19 } | |
| 20 | |
| 21 void test_closure_without_mutate() { | |
| 22 var a = new A(); | |
| 23 a.x = () { | |
| 24 print(a); | |
| 25 }; | |
| 26 a | |
| 27 ..x() | |
| 28 ..x(); | |
| 29 print(a); | |
| 30 } | |
| 31 | |
| 32 void test_mutate_inside_cascade() { | |
| 33 var a; | |
| 34 a = new A() | |
| 35 ..x = (a = null) | |
| 36 ..x = (a = null); | |
| 37 print(a); | |
| 38 } | |
| 39 | |
| 40 void test_mutate_outside_cascade() { | |
| 41 var a, b; | |
| 42 a = new A() | |
| 43 ..x = (b = null) | |
| 44 ..x = (b = null); | |
| 45 a = null; | |
| 46 print(a); | |
| 47 } | |
| 48 | |
| 49 void test_VariableDeclaration_single() { | |
| 50 var a = [] | |
| 51 ..length = 2 | |
| 52 ..add(42); | |
| 53 print(a); | |
| 54 } | |
| 55 | |
| 56 void test_VariableDeclaration_last() { | |
| 57 var a = 42, | |
| 58 b = [] | |
| 59 ..length = 2 | |
| 60 ..add(a); | |
| 61 print(b); | |
| 62 } | |
| 63 | |
| 64 void test_VariableDeclaration_first() { | |
| 65 var a = [] | |
| 66 ..length = 2 | |
| 67 ..add(3), | |
| 68 b = 2; | |
| 69 print(a); | |
| 70 } | |
| 71 | |
| 72 void test_increment() { | |
| 73 var a = new A(); | |
| 74 var y = a | |
| 75 ..x += 1 | |
| 76 ..x -= 1; | |
| 77 } | |
| 78 | |
| 79 class Base<T> { | |
| 80 final List<T> x = <T>[]; | |
| 81 } | |
| 82 | |
| 83 class Foo extends Base<int> { | |
| 84 void test_final_field_generic(t) { | |
| 85 x..add(1)..add(2)..add(3)..add(4); | |
| 86 } | |
| 87 } | |
| OLD | NEW |