| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 engine.resolver; | 5 library engine.resolver; |
| 6 | 6 |
| 7 import "dart:math" as math; | 7 import "dart:math" as math; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/utilities_collection.dart'; | 10 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| (...skipping 11415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11426 // It also covers an important case that is not applicable in the spec: | 11426 // It also covers an important case that is not applicable in the spec: |
| 11427 // for union types, we want an is-check to promote from an union type to | 11427 // for union types, we want an is-check to promote from an union type to |
| 11428 // (a subtype of) any of its members. | 11428 // (a subtype of) any of its members. |
| 11429 // | 11429 // |
| 11430 // The first check, that [! (C << P)], covers the case where [P] and [C] are | 11430 // The first check, that [! (C << P)], covers the case where [P] and [C] are |
| 11431 // unrelated types; This case is not addressed in the spec for static types. | 11431 // unrelated types; This case is not addressed in the spec for static types. |
| 11432 if (currentType == null || | 11432 if (currentType == null || |
| 11433 allowPrecisionLoss || | 11433 allowPrecisionLoss || |
| 11434 !currentType.isMoreSpecificThan(potentialType) || | 11434 !currentType.isMoreSpecificThan(potentialType) || |
| 11435 potentialType.isMoreSpecificThan(currentType)) { | 11435 potentialType.isMoreSpecificThan(currentType)) { |
| 11436 if (element is PropertyInducingElement) { | 11436 // TODO(scheglov) type propagation for instance/top-level fields |
| 11437 PropertyInducingElement variable = element; | 11437 // was disabled because it depends on the order or visiting. |
| 11438 if (!variable.isConst && !variable.isFinal) { | 11438 // If both field and its client are in the same unit, and we visit |
| 11439 return; | 11439 // the client before the field, then propagated type is not set yet. |
| 11440 } | 11440 // if (element is PropertyInducingElement) { |
| 11441 (variable as PropertyInducingElementImpl).propagatedType = | 11441 // PropertyInducingElement variable = element; |
| 11442 potentialType; | 11442 // if (!variable.isConst && !variable.isFinal) { |
| 11443 } | 11443 // return; |
| 11444 // } |
| 11445 // (variable as PropertyInducingElementImpl).propagatedType = |
| 11446 // potentialType; |
| 11447 // } |
| 11444 _overrideManager.setType(element, potentialType); | 11448 _overrideManager.setType(element, potentialType); |
| 11445 } | 11449 } |
| 11446 } | 11450 } |
| 11447 | 11451 |
| 11448 @override | 11452 @override |
| 11449 Object visitAnnotation(Annotation node) { | 11453 Object visitAnnotation(Annotation node) { |
| 11450 AstNode parent = node.parent; | 11454 AstNode parent = node.parent; |
| 11451 if (identical(parent, _enclosingClassDeclaration) || | 11455 if (identical(parent, _enclosingClassDeclaration) || |
| 11452 identical(parent, _enclosingFunctionTypeAlias)) { | 11456 identical(parent, _enclosingFunctionTypeAlias)) { |
| 11453 return null; | 11457 return null; |
| (...skipping 4951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16405 * library. | 16409 * library. |
| 16406 */ | 16410 */ |
| 16407 final HashSet<String> members = new HashSet<String>(); | 16411 final HashSet<String> members = new HashSet<String>(); |
| 16408 | 16412 |
| 16409 /** | 16413 /** |
| 16410 * Names of resolved or unresolved class members that are read in the | 16414 * Names of resolved or unresolved class members that are read in the |
| 16411 * library. | 16415 * library. |
| 16412 */ | 16416 */ |
| 16413 final HashSet<String> readMembers = new HashSet<String>(); | 16417 final HashSet<String> readMembers = new HashSet<String>(); |
| 16414 } | 16418 } |
| OLD | NEW |