| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:js_runtime/shared/embedded_names.dart'; | 5 import 'package:js_runtime/shared/embedded_names.dart'; |
| 6 import 'package:kernel/ast.dart' as ir; | 6 import 'package:kernel/ast.dart' as ir; |
| 7 | 7 |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/names.dart'; | 9 import '../common/names.dart'; |
| 10 import '../compiler.dart'; | 10 import '../compiler.dart'; |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // String is indexable but not iterable. | 296 // String is indexable but not iterable. |
| 297 !mask.satisfies(_backend.helpers.jsStringClass, closedWorld); | 297 !mask.satisfies(_backend.helpers.jsStringClass, closedWorld); |
| 298 } | 298 } |
| 299 | 299 |
| 300 bool isFixedLength(TypeMask mask, ClosedWorld closedWorld) { | 300 bool isFixedLength(TypeMask mask, ClosedWorld closedWorld) { |
| 301 if (mask.isContainer && (mask as ContainerTypeMask).length != null) { | 301 if (mask.isContainer && (mask as ContainerTypeMask).length != null) { |
| 302 // A container on which we have inferred the length. | 302 // A container on which we have inferred the length. |
| 303 return true; | 303 return true; |
| 304 } | 304 } |
| 305 // TODO(sra): Recognize any combination of fixed length indexables. | 305 // TODO(sra): Recognize any combination of fixed length indexables. |
| 306 if (mask.containsOnly(closedWorld.backendClasses.fixedListImplementation) || | 306 if (mask.containsOnly(closedWorld.backendClasses.fixedListClass) || |
| 307 mask.containsOnly(closedWorld.backendClasses.constListImplementation) || | 307 mask.containsOnly(closedWorld.backendClasses.constListClass) || |
| 308 mask.containsOnlyString(closedWorld) || | 308 mask.containsOnlyString(closedWorld) || |
| 309 closedWorld.commonMasks.isTypedArray(mask)) { | 309 closedWorld.commonMasks.isTypedArray(mask)) { |
| 310 return true; | 310 return true; |
| 311 } | 311 } |
| 312 return false; | 312 return false; |
| 313 } | 313 } |
| 314 | 314 |
| 315 TypeMask inferredIndexType(ir.ForInStatement forInStatement) { | 315 TypeMask inferredIndexType(ir.ForInStatement forInStatement) { |
| 316 return TypeMaskFactory.inferredTypeForSelector(new Selector.index(), | 316 return TypeMaskFactory.inferredTypeForSelector(new Selector.index(), |
| 317 typeOfIterator(forInStatement), _globalInferenceResults); | 317 typeOfIterator(forInStatement), _globalInferenceResults); |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 JumpTarget continueTarget = | 1109 JumpTarget continueTarget = |
| 1110 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); | 1110 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); |
| 1111 assert(continueTarget is KernelJumpTarget); | 1111 assert(continueTarget is KernelJumpTarget); |
| 1112 targetIndexMap[continueTarget] = switchIndex; | 1112 targetIndexMap[continueTarget] = switchIndex; |
| 1113 assert(builder.jumpTargets[continueTarget] == null); | 1113 assert(builder.jumpTargets[continueTarget] == null); |
| 1114 builder.jumpTargets[continueTarget] = this; | 1114 builder.jumpTargets[continueTarget] = this; |
| 1115 switchIndex++; | 1115 switchIndex++; |
| 1116 } | 1116 } |
| 1117 } | 1117 } |
| 1118 } | 1118 } |
| OLD | NEW |