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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 void registerImplicitChecks( | 84 void registerImplicitChecks( |
85 WorldBuilder worldBuilder, Iterable<ClassElement> classesUsingChecks); | 85 WorldBuilder worldBuilder, Iterable<ClassElement> classesUsingChecks); |
86 } | 86 } |
87 | 87 |
88 /// Interface for computing substitutions need for runtime type checks. | 88 /// Interface for computing substitutions need for runtime type checks. |
89 abstract class RuntimeTypesSubstitutions { | 89 abstract class RuntimeTypesSubstitutions { |
90 bool isTrivialSubstitution(ClassElement cls, ClassElement check); | 90 bool isTrivialSubstitution(ClassElement cls, ClassElement check); |
91 | 91 |
92 Substitution getSubstitution(ClassElement cls, ClassElement other); | 92 Substitution getSubstitution(ClassElement cls, ClassElement other); |
93 | 93 |
94 /// Compute the required type checkes and substitutions for the given | 94 /// Compute the required type checks and substitutions for the given |
95 /// instantitated and checked classes. | 95 /// instantitated and checked classes. |
96 TypeChecks computeChecks( | 96 TypeChecks computeChecks( |
97 Set<ClassElement> instantiated, Set<ClassElement> checked); | 97 Set<ClassElement> instantiated, Set<ClassElement> checked); |
98 | 98 |
99 Set<ClassElement> getClassesUsedInSubstitutions(TypeChecks checks); | 99 Set<ClassElement> getClassesUsedInSubstitutions(TypeChecks checks); |
100 | 100 |
101 static bool hasTypeArguments(ResolutionDartType type) { | 101 static bool hasTypeArguments(ResolutionDartType type) { |
102 if (type is ResolutionInterfaceType) { | 102 if (type is ResolutionInterfaceType) { |
103 ResolutionInterfaceType interfaceType = type; | 103 ResolutionInterfaceType interfaceType = type; |
104 return !interfaceType.treatAsRaw; | 104 return !interfaceType.treatAsRaw; |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 * substition for this check. | 1161 * substition for this check. |
1162 */ | 1162 */ |
1163 class TypeCheck { | 1163 class TypeCheck { |
1164 final ClassElement cls; | 1164 final ClassElement cls; |
1165 final Substitution substitution; | 1165 final Substitution substitution; |
1166 final int hashCode = _nextHash = (_nextHash + 100003).toUnsigned(30); | 1166 final int hashCode = _nextHash = (_nextHash + 100003).toUnsigned(30); |
1167 static int _nextHash = 0; | 1167 static int _nextHash = 0; |
1168 | 1168 |
1169 TypeCheck(this.cls, this.substitution); | 1169 TypeCheck(this.cls, this.substitution); |
1170 } | 1170 } |
OLD | NEW |