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 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
6 | 6 |
7 import '../closure.dart'; | 7 import '../closure.dart'; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; | 9 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; |
10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 kind: HTypeConversion.BOOLEAN_CONVERSION_CHECK); | 219 kind: HTypeConversion.BOOLEAN_CONVERSION_CHECK); |
220 } | 220 } |
221 HInstruction result = new HBoolify(value, commonMasks.boolType); | 221 HInstruction result = new HBoolify(value, commonMasks.boolType); |
222 add(result); | 222 add(result); |
223 return result; | 223 return result; |
224 } | 224 } |
225 | 225 |
226 void _addClassTypeVariablesIfNeeded(ir.Member constructor) { | 226 void _addClassTypeVariablesIfNeeded(ir.Member constructor) { |
227 var enclosing = constructor.enclosingClass; | 227 var enclosing = constructor.enclosingClass; |
228 if (backend.classNeedsRti(astAdapter.getElement(enclosing))) { | 228 if (backend.classNeedsRti(astAdapter.getElement(enclosing))) { |
| 229 ClassElement clsElement = |
| 230 astAdapter.getElement(constructor).enclosingElement; |
229 enclosing.typeParameters.forEach((ir.TypeParameter typeParameter) { | 231 enclosing.typeParameters.forEach((ir.TypeParameter typeParameter) { |
230 var typeParamElement = astAdapter.getElement(typeParameter); | 232 var typeParamElement = astAdapter.getElement(typeParameter); |
231 HParameterValue param = | 233 HParameterValue param = |
232 addParameter(typeParamElement, commonMasks.nonNullType); | 234 addParameter(typeParamElement, commonMasks.nonNullType); |
233 var dart_type = astAdapter.getDartType(typeParameter.bound); | |
234 // This is a little bit wacky (and n^2) until we make the localsHandler | 235 // This is a little bit wacky (and n^2) until we make the localsHandler |
235 // take Kernel DartTypes instead of just the AST DartTypes. | 236 // take Kernel DartTypes instead of just the AST DartTypes. |
236 var typeVariableType = (astAdapter.getElement(constructor)) | 237 var typeVariableType = clsElement |
237 .enclosingElement | |
238 .typeVariables | 238 .typeVariables |
239 .firstWhere((TypeVariableType i) => i.name == typeParameter.name); | 239 .firstWhere((TypeVariableType i) => i.name == typeParameter.name); |
240 localsHandler.directLocals[ | 240 localsHandler.directLocals[ |
241 localsHandler.getTypeVariableAsLocal(typeVariableType)] = param; | 241 localsHandler.getTypeVariableAsLocal(typeVariableType)] = param; |
242 }); | 242 }); |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
246 /// Builds generative constructors. | 246 /// Builds generative constructors. |
247 /// | 247 /// |
(...skipping 2090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2338 kernelBuilder.open(exitBlock); | 2338 kernelBuilder.open(exitBlock); |
2339 enterBlock.setBlockFlow( | 2339 enterBlock.setBlockFlow( |
2340 new HTryBlockInformation( | 2340 new HTryBlockInformation( |
2341 kernelBuilder.wrapStatementGraph(bodyGraph), | 2341 kernelBuilder.wrapStatementGraph(bodyGraph), |
2342 exception, | 2342 exception, |
2343 kernelBuilder.wrapStatementGraph(catchGraph), | 2343 kernelBuilder.wrapStatementGraph(catchGraph), |
2344 kernelBuilder.wrapStatementGraph(finallyGraph)), | 2344 kernelBuilder.wrapStatementGraph(finallyGraph)), |
2345 exitBlock); | 2345 exitBlock); |
2346 } | 2346 } |
2347 } | 2347 } |
OLD | NEW |