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 4985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4996 ast.CaseMatch match = labelOrCase; | 4996 ast.CaseMatch match = labelOrCase; |
4997 Constant constant = getConstantForNode(match.expression); | 4997 Constant constant = getConstantForNode(match.expression); |
4998 constants[labelOrCase] = constant; | 4998 constants[labelOrCase] = constant; |
4999 } | 4999 } |
5000 } | 5000 } |
5001 } | 5001 } |
5002 return constants; | 5002 return constants; |
5003 } | 5003 } |
5004 | 5004 |
5005 visitSwitchStatement(ast.SwitchStatement node) { | 5005 visitSwitchStatement(ast.SwitchStatement node) { |
5006 Map<ast.CaseMatch,Constant> constants = buildSwitchCaseConstants(node); | 5006 Map<ast.CaseMatch, Constant> constants = buildSwitchCaseConstants(node); |
5007 | 5007 |
5008 // The switch case indices must match those computed in | 5008 // The switch case indices must match those computed in |
5009 // [SwitchCaseJumpHandler]. | 5009 // [SwitchCaseJumpHandler]. |
5010 bool hasContinue = false; | 5010 bool hasContinue = false; |
5011 Map<ast.SwitchCase, int> caseIndex = new Map<ast.SwitchCase, int>(); | 5011 Map<ast.SwitchCase, int> caseIndex = new Map<ast.SwitchCase, int>(); |
5012 int switchIndex = 1; | 5012 int switchIndex = 1; |
5013 bool hasDefault = false; | 5013 bool hasDefault = false; |
5014 for (ast.SwitchCase switchCase in node.cases) { | 5014 for (ast.SwitchCase switchCase in node.cases) { |
5015 for (ast.Node labelOrCase in switchCase.labelsAndCases) { | 5015 for (ast.Node labelOrCase in switchCase.labelsAndCases) { |
5016 ast.Node label = labelOrCase.asLabel(); | 5016 ast.Node label = labelOrCase.asLabel(); |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6110 DartType unaliased = type.unalias(builder.compiler); | 6110 DartType unaliased = type.unalias(builder.compiler); |
6111 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 6111 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
6112 unaliased.accept(this, builder); | 6112 unaliased.accept(this, builder); |
6113 } | 6113 } |
6114 | 6114 |
6115 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 6115 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
6116 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); | 6116 ClassElement cls = builder.compiler.findHelper('DynamicRuntimeType'); |
6117 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); | 6117 builder.push(new HDynamicType(type, new TypeMask.exact(cls))); |
6118 } | 6118 } |
6119 } | 6119 } |
OLD | NEW |