| 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 part of js_backend.backend; | 5 part of js_backend.backend; |
| 6 | 6 |
| 7 /// For each class, stores the possible class subtype tests that could succeed. | 7 /// For each class, stores the possible class subtype tests that could succeed. |
| 8 abstract class TypeChecks { | 8 abstract class TypeChecks { |
| 9 /// Get the set of checks required for class [element]. | 9 /// Get the set of checks required for class [element]. |
| 10 Iterable<TypeCheck> operator [](ClassElement element); | 10 Iterable<TypeCheck> operator [](ClassElement element); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 * have a type check against this supertype that includes a check against | 523 * have a type check against this supertype that includes a check against |
| 524 * the type arguments. | 524 * the type arguments. |
| 525 */ | 525 */ |
| 526 void computeInstantiatedArguments(Set<ResolutionDartType> instantiatedTypes, | 526 void computeInstantiatedArguments(Set<ResolutionDartType> instantiatedTypes, |
| 527 Set<ResolutionDartType> isChecks) { | 527 Set<ResolutionDartType> isChecks) { |
| 528 ArgumentCollector superCollector = new ArgumentCollector(); | 528 ArgumentCollector superCollector = new ArgumentCollector(); |
| 529 ArgumentCollector directCollector = new ArgumentCollector(); | 529 ArgumentCollector directCollector = new ArgumentCollector(); |
| 530 FunctionArgumentCollector functionArgumentCollector = | 530 FunctionArgumentCollector functionArgumentCollector = |
| 531 new FunctionArgumentCollector(); | 531 new FunctionArgumentCollector(); |
| 532 | 532 |
| 533 // We need to add classes occuring in function type arguments, like for | 533 // We need to add classes occurring in function type arguments, like for |
| 534 // instance 'I' for [: o is C<f> :] where f is [: typedef I f(); :]. | 534 // instance 'I' for [: o is C<f> :] where f is [: typedef I f(); :]. |
| 535 void collectFunctionTypeArguments(Iterable<ResolutionDartType> types) { | 535 void collectFunctionTypeArguments(Iterable<ResolutionDartType> types) { |
| 536 for (ResolutionDartType type in types) { | 536 for (ResolutionDartType type in types) { |
| 537 functionArgumentCollector.collect(type); | 537 functionArgumentCollector.collect(type); |
| 538 } | 538 } |
| 539 } | 539 } |
| 540 | 540 |
| 541 collectFunctionTypeArguments(isChecks); | 541 collectFunctionTypeArguments(isChecks); |
| 542 collectFunctionTypeArguments(checkedBounds); | 542 collectFunctionTypeArguments(checkedBounds); |
| 543 | 543 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 569 ..addAll(directlyInstantiatedArguments); | 569 ..addAll(directlyInstantiatedArguments); |
| 570 } | 570 } |
| 571 | 571 |
| 572 /// Collects all type arguments used in is-checks. | 572 /// Collects all type arguments used in is-checks. |
| 573 void computeCheckedArguments(Set<ResolutionDartType> instantiatedTypes, | 573 void computeCheckedArguments(Set<ResolutionDartType> instantiatedTypes, |
| 574 Set<ResolutionDartType> isChecks) { | 574 Set<ResolutionDartType> isChecks) { |
| 575 ArgumentCollector collector = new ArgumentCollector(); | 575 ArgumentCollector collector = new ArgumentCollector(); |
| 576 FunctionArgumentCollector functionArgumentCollector = | 576 FunctionArgumentCollector functionArgumentCollector = |
| 577 new FunctionArgumentCollector(); | 577 new FunctionArgumentCollector(); |
| 578 | 578 |
| 579 // We need to add types occuring in function type arguments, like for | 579 // We need to add types occurring in function type arguments, like for |
| 580 // instance 'J' for [: (J j) {} is f :] where f is | 580 // instance 'J' for [: (J j) {} is f :] where f is |
| 581 // [: typedef void f(I i); :] and 'J' is a subtype of 'I'. | 581 // [: typedef void f(I i); :] and 'J' is a subtype of 'I'. |
| 582 void collectFunctionTypeArguments(Iterable<ResolutionDartType> types) { | 582 void collectFunctionTypeArguments(Iterable<ResolutionDartType> types) { |
| 583 for (ResolutionDartType type in types) { | 583 for (ResolutionDartType type in types) { |
| 584 functionArgumentCollector.collect(type); | 584 functionArgumentCollector.collect(type); |
| 585 } | 585 } |
| 586 } | 586 } |
| 587 | 587 |
| 588 collectFunctionTypeArguments(instantiatedTypes); | 588 collectFunctionTypeArguments(instantiatedTypes); |
| 589 collectFunctionTypeArguments(checkedTypeArguments); | 589 collectFunctionTypeArguments(checkedTypeArguments); |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 * substition for this check. | 1158 * substition for this check. |
| 1159 */ | 1159 */ |
| 1160 class TypeCheck { | 1160 class TypeCheck { |
| 1161 final ClassElement cls; | 1161 final ClassElement cls; |
| 1162 final Substitution substitution; | 1162 final Substitution substitution; |
| 1163 final int hashCode = _nextHash = (_nextHash + 100003).toUnsigned(30); | 1163 final int hashCode = _nextHash = (_nextHash + 100003).toUnsigned(30); |
| 1164 static int _nextHash = 0; | 1164 static int _nextHash = 0; |
| 1165 | 1165 |
| 1166 TypeCheck(this.cls, this.substitution); | 1166 TypeCheck(this.cls, this.substitution); |
| 1167 } | 1167 } |
| OLD | NEW |