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 library type_graph_inferrer; | 5 library type_graph_inferrer; |
6 | 6 |
7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 return nonNullEmptyType; | 360 return nonNullEmptyType; |
361 } | 361 } |
362 | 362 |
363 bool isNull(TypeInformation type) { | 363 bool isNull(TypeInformation type) { |
364 return type == nullType; | 364 return type == nullType; |
365 } | 365 } |
366 | 366 |
367 TypeInformation allocateList( | 367 TypeInformation allocateList( |
368 TypeInformation type, ast.Node node, Element enclosing, | 368 TypeInformation type, ast.Node node, Element enclosing, |
369 [TypeInformation elementType, int length]) { | 369 [TypeInformation elementType, int length]) { |
370 bool isTypedArray = compiler.typedDataClass != null && | 370 ClassElement typedDataClass = compiler.commonElements.typedDataClass; |
371 classWorld.isInstantiated(compiler.typedDataClass) && | 371 bool isTypedArray = typedDataClass != null && |
372 type.type.satisfies(compiler.typedDataClass, classWorld); | 372 classWorld.isInstantiated(typedDataClass) && |
| 373 type.type.satisfies(typedDataClass, classWorld); |
373 bool isConst = (type.type == compiler.typesTask.constListType); | 374 bool isConst = (type.type == compiler.typesTask.constListType); |
374 bool isFixed = (type.type == compiler.typesTask.fixedListType) || | 375 bool isFixed = (type.type == compiler.typesTask.fixedListType) || |
375 isConst || | 376 isConst || |
376 isTypedArray; | 377 isTypedArray; |
377 bool isElementInferred = isConst || isTypedArray; | 378 bool isElementInferred = isConst || isTypedArray; |
378 | 379 |
379 int inferredLength = isFixed ? length : null; | 380 int inferredLength = isFixed ? length : null; |
380 TypeMask elementTypeMask = | 381 TypeMask elementTypeMask = |
381 isElementInferred ? elementType.type : dynamicType.type; | 382 isElementInferred ? elementType.type : dynamicType.type; |
382 ContainerTypeMask mask = new ContainerTypeMask( | 383 ContainerTypeMask mask = new ContainerTypeMask( |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 bool isCalledOnce(Element element) { | 1433 bool isCalledOnce(Element element) { |
1433 if (compiler.disableTypeInference) return false; | 1434 if (compiler.disableTypeInference) return false; |
1434 MemberTypeInformation info = inferrer.types.getInferredTypeOf(element); | 1435 MemberTypeInformation info = inferrer.types.getInferredTypeOf(element); |
1435 return info.isCalledOnce(); | 1436 return info.isCalledOnce(); |
1436 } | 1437 } |
1437 | 1438 |
1438 void clear() { | 1439 void clear() { |
1439 inferrer.clear(); | 1440 inferrer.clear(); |
1440 } | 1441 } |
1441 } | 1442 } |
OLD | NEW |