| 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 library kernel.analyzer.ast_from_analyzer; | 4 library kernel.analyzer.ast_from_analyzer; |
| 5 | 5 |
| 6 import '../ast.dart' as ast; | 6 import '../ast.dart' as ast; |
| 7 import '../frontend/accessors.dart'; | 7 import '../frontend/accessors.dart'; |
| 8 import '../frontend/super_initializers.dart'; | 8 import '../frontend/super_initializers.dart'; |
| 9 import '../log.dart'; | 9 import '../log.dart'; |
| 10 import '../type_algebra.dart'; | 10 import '../type_algebra.dart'; |
| (...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 var labelToNode = <String, ast.SwitchCase>{}; | 1106 var labelToNode = <String, ast.SwitchCase>{}; |
| 1107 ast.SwitchCase currentCase = null; | 1107 ast.SwitchCase currentCase = null; |
| 1108 for (var member in node.members) { | 1108 for (var member in node.members) { |
| 1109 if (currentCase != null && currentCase.isDefault) { | 1109 if (currentCase != null && currentCase.isDefault) { |
| 1110 var error = member is SwitchCase | 1110 var error = member is SwitchCase |
| 1111 ? ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE | 1111 ? ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE |
| 1112 : ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES; | 1112 : ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES; |
| 1113 return scope.emitCompileTimeError(error); | 1113 return scope.emitCompileTimeError(error); |
| 1114 } | 1114 } |
| 1115 if (currentCase == null) { | 1115 if (currentCase == null) { |
| 1116 currentCase = new ast.SwitchCase(<ast.Expression>[], null); | 1116 currentCase = new ast.SwitchCase(<ast.Expression>[], <int>[], null); |
| 1117 cases.add(currentCase); | 1117 cases.add(currentCase); |
| 1118 } | 1118 } |
| 1119 if (member is SwitchCase) { | 1119 if (member is SwitchCase) { |
| 1120 var expression = scope.buildExpression(member.expression); | 1120 var expression = scope.buildExpression(member.expression); |
| 1121 currentCase.expressions.add(expression..parent = currentCase); | 1121 currentCase.expressions.add(expression..parent = currentCase); |
| 1122 } else { | 1122 } else { |
| 1123 currentCase.isDefault = true; | 1123 currentCase.isDefault = true; |
| 1124 } | 1124 } |
| 1125 for (Label label in member.labels) { | 1125 for (Label label in member.labels) { |
| 1126 continueNode = | 1126 continueNode = |
| (...skipping 1943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3070 if (list[i - 1].compareTo(item) == 0) { | 3070 if (list[i - 1].compareTo(item) == 0) { |
| 3071 ++deleted; | 3071 ++deleted; |
| 3072 } else if (deleted > 0) { | 3072 } else if (deleted > 0) { |
| 3073 list[i - deleted] = item; | 3073 list[i - deleted] = item; |
| 3074 } | 3074 } |
| 3075 } | 3075 } |
| 3076 if (deleted > 0) { | 3076 if (deleted > 0) { |
| 3077 list.length -= deleted; | 3077 list.length -= deleted; |
| 3078 } | 3078 } |
| 3079 } | 3079 } |
| OLD | NEW |