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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 /// Extend current method parameters with parameters for the class type | 222 /// Extend current method parameters with parameters for the class type |
223 /// parameters. If the class has type parameters but does not need them, bind | 223 /// parameters. If the class has type parameters but does not need them, bind |
224 /// to `dynamic` (represented as `null`) so the bindings are available for | 224 /// to `dynamic` (represented as `null`) so the bindings are available for |
225 /// building types up the inheritance chain of generative constructors. | 225 /// building types up the inheritance chain of generative constructors. |
226 void _addClassTypeVariablesIfNeeded(ir.Member constructor) { | 226 void _addClassTypeVariablesIfNeeded(ir.Member constructor) { |
227 var enclosing = constructor.enclosingClass; | 227 var enclosing = constructor.enclosingClass; |
228 bool needParameters; | 228 bool needParameters; |
229 enclosing.typeParameters.forEach((ir.TypeParameter typeParameter) { | 229 enclosing.typeParameters.forEach((ir.TypeParameter typeParameter) { |
230 var typeParamElement = astAdapter.getElement(typeParameter); | 230 var typeParamElement = astAdapter.getElement(typeParameter); |
231 HInstruction param; | 231 HInstruction param; |
232 needParameters ??= | 232 needParameters ??= rtiNeed.classNeedsRti(astAdapter.getClass(enclosing)); |
233 rtiNeed.classNeedsRti(astAdapter.getElement(enclosing)); | |
234 if (needParameters) { | 233 if (needParameters) { |
235 param = addParameter(typeParamElement, commonMasks.nonNullType); | 234 param = addParameter(typeParamElement, commonMasks.nonNullType); |
236 } else { | 235 } else { |
237 // Unused, so bind to `dynamic`. | 236 // Unused, so bind to `dynamic`. |
238 param = graph.addConstantNull(closedWorld); | 237 param = graph.addConstantNull(closedWorld); |
239 } | 238 } |
240 // This is a little bit wacky (and n^2) until we make the localsHandler | 239 // This is a little bit wacky (and n^2) until we make the localsHandler |
241 // take Kernel DartTypes instead of just the AST DartTypes. | 240 // take Kernel DartTypes instead of just the AST DartTypes. |
242 var typeVariableType = astAdapter | 241 var typeVariableType = astAdapter |
243 .getClass(enclosing) | 242 .getClass(enclosing) |
(...skipping 3170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3414 enterBlock.setBlockFlow( | 3413 enterBlock.setBlockFlow( |
3415 new HTryBlockInformation( | 3414 new HTryBlockInformation( |
3416 kernelBuilder.wrapStatementGraph(bodyGraph), | 3415 kernelBuilder.wrapStatementGraph(bodyGraph), |
3417 exception, | 3416 exception, |
3418 kernelBuilder.wrapStatementGraph(catchGraph), | 3417 kernelBuilder.wrapStatementGraph(catchGraph), |
3419 kernelBuilder.wrapStatementGraph(finallyGraph)), | 3418 kernelBuilder.wrapStatementGraph(finallyGraph)), |
3420 exitBlock); | 3419 exitBlock); |
3421 kernelBuilder.inTryStatement = previouslyInTryStatement; | 3420 kernelBuilder.inTryStatement = previouslyInTryStatement; |
3422 } | 3421 } |
3423 } | 3422 } |
OLD | NEW |