| 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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
| 7 import | 7 import |
| 8 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' | 8 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' |
| 9 show ContainerTypeMask, TypeMask; | 9 show ContainerTypeMask, TypeMask; |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 var listUnset = $listAllocation; | 80 var listUnset = $listAllocation; |
| 81 var listOnlySetWithConstraint = $listAllocation; | 81 var listOnlySetWithConstraint = $listAllocation; |
| 82 var listEscapingInSetterValue = $listAllocation; | 82 var listEscapingInSetterValue = $listAllocation; |
| 83 var listEscapingInIndex = $listAllocation; | 83 var listEscapingInIndex = $listAllocation; |
| 84 var listEscapingInIndexSet = $listAllocation; | 84 var listEscapingInIndexSet = $listAllocation; |
| 85 var listEscapingTwiceInIndexSet = $listAllocation; | 85 var listEscapingTwiceInIndexSet = $listAllocation; |
| 86 var listPassedAsOptionalParameter = $listAllocation; | 86 var listPassedAsOptionalParameter = $listAllocation; |
| 87 var listPassedAsNamedParameter = $listAllocation; | 87 var listPassedAsNamedParameter = $listAllocation; |
| 88 var listSetInNonFinalField = $listAllocation; | 88 var listSetInNonFinalField = $listAllocation; |
| 89 var listWithChangedLength = $listAllocation; | 89 var listWithChangedLength = $listAllocation; |
| 90 var listStoredInList = $listAllocation; |
| 91 var listStoredInListButEscapes = $listAllocation; |
| 90 | 92 |
| 91 foo(list) { | 93 foo(list) { |
| 92 list[0] = aDouble; | 94 list[0] = aDouble; |
| 93 } | 95 } |
| 94 | 96 |
| 95 bar() { | 97 bar() { |
| 96 return listReturnedFromMethod; | 98 return listReturnedFromMethod; |
| 97 } | 99 } |
| 98 | 100 |
| 99 takeOptional([list]) { | 101 takeOptional([list]) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 takeOptional(listPassedAsOptionalParameter); | 170 takeOptional(listPassedAsOptionalParameter); |
| 169 | 171 |
| 170 listPassedAsNamedParameter[0] = anInt; | 172 listPassedAsNamedParameter[0] = anInt; |
| 171 takeNamed(list: listPassedAsNamedParameter); | 173 takeNamed(list: listPassedAsNamedParameter); |
| 172 | 174 |
| 173 listSetInNonFinalField[0] = anInt; | 175 listSetInNonFinalField[0] = anInt; |
| 174 new B(listSetInNonFinalField); | 176 new B(listSetInNonFinalField); |
| 175 | 177 |
| 176 listWithChangedLength[0] = anInt; | 178 listWithChangedLength[0] = anInt; |
| 177 listWithChangedLength.length = 54; | 179 listWithChangedLength.length = 54; |
| 180 |
| 181 a = [listStoredInList]; |
| 182 a[0][0] = 42; |
| 183 |
| 184 a = [listStoredInListButEscapes]; |
| 185 a[0][0] = 42; |
| 186 a.forEach((e) => print(e)); |
| 178 } | 187 } |
| 179 """; | 188 """; |
| 180 } | 189 } |
| 181 | 190 |
| 182 void main() { | 191 void main() { |
| 183 doTest('[]', nullify: false); // Test literal list. | 192 doTest('[]', nullify: false); // Test literal list. |
| 184 doTest('new List()', nullify: false); // Test growable list. | 193 doTest('new List()', nullify: false); // Test growable list. |
| 185 doTest('new List(1)', nullify: true); // Test fixed list. | 194 doTest('new List(1)', nullify: true); // Test fixed list. |
| 186 doTest('new List.filled(1, 0)', nullify: false); // Test List.filled. | 195 doTest('new List.filled(1, 0)', nullify: false); // Test List.filled. |
| 187 doTest('new List.filled(1, null)', nullify: true); // Test List.filled. | 196 doTest('new List.filled(1, null)', nullify: true); // Test List.filled. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 217 checkType('listEscapingInIndexSet', typesTask.uint31Type); | 226 checkType('listEscapingInIndexSet', typesTask.uint31Type); |
| 218 checkType('listEscapingTwiceInIndexSet', typesTask.numType); | 227 checkType('listEscapingTwiceInIndexSet', typesTask.numType); |
| 219 checkType('listSetInNonFinalField', typesTask.numType); | 228 checkType('listSetInNonFinalField', typesTask.numType); |
| 220 checkType('listWithChangedLength', typesTask.uint31Type.nullable()); | 229 checkType('listWithChangedLength', typesTask.uint31Type.nullable()); |
| 221 | 230 |
| 222 checkType('listPassedToClosure', typesTask.dynamicType); | 231 checkType('listPassedToClosure', typesTask.dynamicType); |
| 223 checkType('listReturnedFromClosure', typesTask.dynamicType); | 232 checkType('listReturnedFromClosure', typesTask.dynamicType); |
| 224 checkType('listUsedWithNonOkSelector', typesTask.dynamicType); | 233 checkType('listUsedWithNonOkSelector', typesTask.dynamicType); |
| 225 checkType('listPassedAsOptionalParameter', typesTask.numType); | 234 checkType('listPassedAsOptionalParameter', typesTask.numType); |
| 226 checkType('listPassedAsNamedParameter', typesTask.numType); | 235 checkType('listPassedAsNamedParameter', typesTask.numType); |
| 236 checkType('listStoredInList', typesTask.uint31Type); |
| 237 checkType('listStoredInListButEscapes', typesTask.dynamicType); |
| 227 | 238 |
| 228 if (!allocation.contains('filled')) { | 239 if (!allocation.contains('filled')) { |
| 229 checkType('listUnset', new TypeMask.nonNullEmpty()); | 240 checkType('listUnset', new TypeMask.nonNullEmpty()); |
| 230 checkType('listOnlySetWithConstraint', new TypeMask.nonNullEmpty()); | 241 checkType('listOnlySetWithConstraint', new TypeMask.nonNullEmpty()); |
| 231 } | 242 } |
| 232 })); | 243 })); |
| 233 } | 244 } |
| OLD | NEW |