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 class SsaCodeGeneratorTask extends CompilerTask { | 7 class SsaCodeGeneratorTask extends CompilerTask { |
8 | 8 |
9 final JavaScriptBackend backend; | 9 final JavaScriptBackend backend; |
10 | 10 |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 js.Expression key = pop(); | 693 js.Expression key = pop(); |
694 List<js.SwitchClause> cases = <js.SwitchClause>[]; | 694 List<js.SwitchClause> cases = <js.SwitchClause>[]; |
695 | 695 |
696 js.Block oldContainer = currentContainer; | 696 js.Block oldContainer = currentContainer; |
697 for (int i = 0; i < info.matchExpressions.length; i++) { | 697 for (int i = 0; i < info.matchExpressions.length; i++) { |
698 for (Constant constant in info.matchExpressions[i]) { | 698 for (Constant constant in info.matchExpressions[i]) { |
699 generateConstant(constant); | 699 generateConstant(constant); |
700 currentContainer = new js.Block.empty(); | 700 currentContainer = new js.Block.empty(); |
701 cases.add(new js.Case(pop(), currentContainer)); | 701 cases.add(new js.Case(pop(), currentContainer)); |
702 } | 702 } |
703 if (i == info.matchExpressions.length - 1 && info.hasDefault) { | 703 if (i == info.matchExpressions.length - 1) { |
704 currentContainer = new js.Block.empty(); | 704 currentContainer = new js.Block.empty(); |
705 cases.add(new js.Default(currentContainer)); | 705 cases.add(new js.Default(currentContainer)); |
706 } | 706 } |
707 generateStatements(info.statements[i]); | 707 generateStatements(info.statements[i]); |
708 } | 708 } |
709 currentContainer = oldContainer; | 709 currentContainer = oldContainer; |
710 | 710 |
711 js.Statement result = new js.Switch(key, cases); | 711 js.Statement result = new js.Switch(key, cases); |
712 pushStatement(wrapIntoLabels(result, info.labels)); | 712 pushStatement(wrapIntoLabels(result, info.labels)); |
713 return true; | 713 return true; |
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2984 if (leftType.canBeNull() && rightType.canBeNull()) { | 2984 if (leftType.canBeNull() && rightType.canBeNull()) { |
2985 if (left.isConstantNull() || right.isConstantNull() || | 2985 if (left.isConstantNull() || right.isConstantNull() || |
2986 (leftType.isPrimitive(compiler) && leftType == rightType)) { | 2986 (leftType.isPrimitive(compiler) && leftType == rightType)) { |
2987 return '=='; | 2987 return '=='; |
2988 } | 2988 } |
2989 return null; | 2989 return null; |
2990 } else { | 2990 } else { |
2991 return '==='; | 2991 return '==='; |
2992 } | 2992 } |
2993 } | 2993 } |
OLD | NEW |