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 'graph_builder.dart'; | 5 import 'graph_builder.dart'; |
6 import 'nodes.dart'; | 6 import 'nodes.dart'; |
7 import '../closure.dart'; | 7 import '../closure.dart'; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../types/types.dart'; | 9 import '../types/types.dart'; |
10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 TypeInfoExpressionKind.INSTANCE, | 158 TypeInfoExpressionKind.INSTANCE, |
159 builder.closedWorld.elementEnvironment.getThisType(interface.element), | 159 builder.closedWorld.elementEnvironment.getThisType(interface.element), |
160 inputs, | 160 inputs, |
161 builder.commonMasks.dynamicType); | 161 builder.commonMasks.dynamicType); |
162 return representation; | 162 return representation; |
163 } | 163 } |
164 | 164 |
165 /// Check that [type] is valid in the context of `localsHandler.contextClass`. | 165 /// Check that [type] is valid in the context of `localsHandler.contextClass`. |
166 /// This should only be called in assertions. | 166 /// This should only be called in assertions. |
167 bool assertTypeInContext(DartType type, [Spannable spannable]) { | 167 bool assertTypeInContext(DartType type, [Spannable spannable]) { |
168 if (builder.compiler.options.useKernel) return true; | 168 if (builder.compiler.options.useKernelInSsa) return true; |
169 if (builder.compiler.options.loadFromDill) return true; | |
170 ClassEntity contextClass = DartTypes.getClassContext(type); | 169 ClassEntity contextClass = DartTypes.getClassContext(type); |
171 assert( | 170 assert( |
172 contextClass == null || | 171 contextClass == null || |
173 contextClass == builder.localsHandler.contextClass, | 172 contextClass == builder.localsHandler.contextClass, |
174 failedAt( | 173 failedAt( |
175 spannable ?? CURRENT_ELEMENT_SPANNABLE, | 174 spannable ?? CURRENT_ELEMENT_SPANNABLE, |
176 "Type '$type' is not valid context of " | 175 "Type '$type' is not valid context of " |
177 "${builder.localsHandler.contextClass}.")); | 176 "${builder.localsHandler.contextClass}.")); |
178 return true; | 177 return true; |
179 } | 178 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 analyzeTypeArgument(type, builder.sourceElement); | 265 analyzeTypeArgument(type, builder.sourceElement); |
267 // TypeMasks don't encode function types. | 266 // TypeMasks don't encode function types. |
268 TypeMask refinedMask = original.instructionType; | 267 TypeMask refinedMask = original.instructionType; |
269 return new HTypeConversion.withTypeRepresentation( | 268 return new HTypeConversion.withTypeRepresentation( |
270 type, kind, refinedMask, original, reifiedType); | 269 type, kind, refinedMask, original, reifiedType); |
271 } else { | 270 } else { |
272 return original.convertType(builder.closedWorld, type, kind); | 271 return original.convertType(builder.closedWorld, type, kind); |
273 } | 272 } |
274 } | 273 } |
275 } | 274 } |
OLD | NEW |