OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 ssa; | 5 part of ssa; |
6 | 6 |
7 /** | 7 /** |
8 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
9 * methods. We need to override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 "Parameters and arguments didn't match for super/redirect call", | 1340 "Parameters and arguments didn't match for super/redirect call", |
1341 element: constructor); | 1341 element: constructor); |
1342 } | 1342 } |
1343 | 1343 |
1344 ClassElement superclass = constructor.getEnclosingClass(); | 1344 ClassElement superclass = constructor.getEnclosingClass(); |
1345 if (backend.classNeedsRti(superclass)) { | 1345 if (backend.classNeedsRti(superclass)) { |
1346 // If [superclass] needs RTI, we have to give a value to its | 1346 // If [superclass] needs RTI, we have to give a value to its |
1347 // type parameters. Those values are in the [supertype] | 1347 // type parameters. Those values are in the [supertype] |
1348 // declaration of [subclass]. | 1348 // declaration of [subclass]. |
1349 ClassElement subclass = inlinedFromElement.getEnclosingClass(); | 1349 ClassElement subclass = inlinedFromElement.getEnclosingClass(); |
| 1350 // If [inlinedFromElement] is a generative constructor then [superclass]
|
| 1351 // is a superclass of [subclass]. If [inlinedFromElement] is a |
| 1352 // redirecting constructor then [superclass] is the same as [subclass]. |
| 1353 // Using [DartType.asInstanceOf] handles both these cases. |
1350 InterfaceType supertype = subclass.thisType.asInstanceOf(superclass); | 1354 InterfaceType supertype = subclass.thisType.asInstanceOf(superclass); |
1351 Link<DartType> typeVariables = superclass.typeVariables; | 1355 Link<DartType> typeVariables = superclass.typeVariables; |
1352 supertype.typeArguments.forEach((DartType argument) { | 1356 supertype.typeArguments.forEach((DartType argument) { |
1353 localsHandler.updateLocal(typeVariables.head.element, | 1357 localsHandler.updateLocal(typeVariables.head.element, |
1354 analyzeTypeArgument(argument, callNode)); | 1358 analyzeTypeArgument(argument, callNode)); |
1355 typeVariables = typeVariables.tail; | 1359 typeVariables = typeVariables.tail; |
1356 }); | 1360 }); |
1357 // If the supertype is a raw type, we need to set to null the | 1361 // If the supertype is a raw type, we need to set to null the |
1358 // type variables. | 1362 // type variables. |
1359 assert(typeVariables.isEmpty | 1363 assert(typeVariables.isEmpty |
(...skipping 4077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5437 new HSubGraphBlockInformation(elseBranch.graph)); | 5441 new HSubGraphBlockInformation(elseBranch.graph)); |
5438 | 5442 |
5439 HBasicBlock conditionStartBlock = conditionBranch.block; | 5443 HBasicBlock conditionStartBlock = conditionBranch.block; |
5440 conditionStartBlock.setBlockFlow(info, joinBlock); | 5444 conditionStartBlock.setBlockFlow(info, joinBlock); |
5441 SubGraph conditionGraph = conditionBranch.graph; | 5445 SubGraph conditionGraph = conditionBranch.graph; |
5442 HIf branch = conditionGraph.end.last; | 5446 HIf branch = conditionGraph.end.last; |
5443 assert(branch is HIf); | 5447 assert(branch is HIf); |
5444 branch.blockInformation = conditionStartBlock.blockFlow; | 5448 branch.blockInformation = conditionStartBlock.blockFlow; |
5445 } | 5449 } |
5446 } | 5450 } |
OLD | NEW |