| 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 4414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4425 compiler.constantHandler.compileNodeWithDefinitions( | 4425 compiler.constantHandler.compileNodeWithDefinitions( |
| 4426 match.expression, elements, isConst: true); | 4426 match.expression, elements, isConst: true); |
| 4427 if (firstConstantType == null) { | 4427 if (firstConstantType == null) { |
| 4428 firstConstantType = constant.computeType(compiler); | 4428 firstConstantType = constant.computeType(compiler); |
| 4429 if (nonPrimitiveTypeOverridesEquals(constant)) { | 4429 if (nonPrimitiveTypeOverridesEquals(constant)) { |
| 4430 compiler.reportFatalError( | 4430 compiler.reportFatalError( |
| 4431 match.expression, | 4431 match.expression, |
| 4432 MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS); | 4432 MessageKind.SWITCH_CASE_VALUE_OVERRIDES_EQUALS); |
| 4433 failure = true; | 4433 failure = true; |
| 4434 } | 4434 } |
| 4435 } else { | |
| 4436 DartType constantType = | |
| 4437 constant.computeType(compiler); | |
| 4438 if (constantType != firstConstantType) { | |
| 4439 compiler.reportFatalError( | |
| 4440 match.expression, | |
| 4441 MessageKind.SWITCH_CASE_TYPES_NOT_EQUAL); | |
| 4442 failure = true; | |
| 4443 } | |
| 4444 } | 4435 } |
| 4445 constants[labelOrCase] = constant; | 4436 constants[labelOrCase] = constant; |
| 4446 } | 4437 } |
| 4447 } | 4438 } |
| 4448 } | 4439 } |
| 4449 return constants; | 4440 return constants; |
| 4450 } | 4441 } |
| 4451 | 4442 |
| 4452 visitSwitchStatement(SwitchStatement node) { | 4443 visitSwitchStatement(SwitchStatement node) { |
| 4453 Map<CaseMatch,Constant> constants = buildSwitchCaseConstants(node); | 4444 Map<CaseMatch,Constant> constants = buildSwitchCaseConstants(node); |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5452 new HSubGraphBlockInformation(elseBranch.graph)); | 5443 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5453 | 5444 |
| 5454 HBasicBlock conditionStartBlock = conditionBranch.block; | 5445 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5455 conditionStartBlock.setBlockFlow(info, joinBlock); | 5446 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5456 SubGraph conditionGraph = conditionBranch.graph; | 5447 SubGraph conditionGraph = conditionBranch.graph; |
| 5457 HIf branch = conditionGraph.end.last; | 5448 HIf branch = conditionGraph.end.last; |
| 5458 assert(branch is HIf); | 5449 assert(branch is HIf); |
| 5459 branch.blockInformation = conditionStartBlock.blockFlow; | 5450 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5460 } | 5451 } |
| 5461 } | 5452 } |
| OLD | NEW |