| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Categorizes `noSuchMethod` implementations. | 8 * Categorizes `noSuchMethod` implementations. |
| 9 * | 9 * |
| 10 * If user code includes `noSuchMethod` implementations, type inference is | 10 * If user code includes `noSuchMethod` implementations, type inference is |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 164 |
| 165 bool _hasThrowingSyntax(FunctionElement element) { | 165 bool _hasThrowingSyntax(FunctionElement element) { |
| 166 Statement body = element.node.body; | 166 Statement body = element.node.body; |
| 167 if (body is Return && body.isArrowBody) { | 167 if (body is Return && body.isArrowBody) { |
| 168 if (body.expression is Throw) { | 168 if (body.expression is Throw) { |
| 169 return true; | 169 return true; |
| 170 } | 170 } |
| 171 } else if (body is Block && | 171 } else if (body is Block && |
| 172 !body.statements.isEmpty && | 172 !body.statements.isEmpty && |
| 173 body.statements.nodes.tail.isEmpty) { | 173 body.statements.nodes.tail.isEmpty) { |
| 174 if (body.statements.nodes.head is Throw) { | 174 if (body.statements.nodes.head is ExpressionStatement) { |
| 175 return true; | 175 ExpressionStatement stmt = body.statements.nodes.head; |
| 176 return stmt.expression is Throw; |
| 176 } | 177 } |
| 177 } | 178 } |
| 178 return false; | 179 return false; |
| 179 } | 180 } |
| 180 } | 181 } |
| 181 | 182 |
| 182 enum NsmCategory { DEFAULT, THROWING, OTHER } | 183 enum NsmCategory { DEFAULT, THROWING, OTHER } |
| OLD | NEW |