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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 expr = body.expression; | 200 expr = body.expression; |
201 } else if (body is Block && | 201 } else if (body is Block && |
202 !body.statements.isEmpty && | 202 !body.statements.isEmpty && |
203 body.statements.nodes.tail.isEmpty) { | 203 body.statements.nodes.tail.isEmpty) { |
204 Statement stmt = body.statements.nodes.head; | 204 Statement stmt = body.statements.nodes.head; |
205 if (stmt is Return && stmt.hasExpression) { | 205 if (stmt is Return && stmt.hasExpression) { |
206 expr = stmt.expression; | 206 expr = stmt.expression; |
207 } | 207 } |
208 } | 208 } |
209 if (expr is Send && | 209 if (expr is Send && |
| 210 expr.isTypeCast && |
| 211 expr.typeAnnotationFromIsCheckOrCast.typeName.source == "dynamic") { |
| 212 expr = expr.receiver; |
| 213 } |
| 214 if (expr is Send && |
210 expr.isSuperCall && | 215 expr.isSuperCall && |
211 expr.selector is Identifier && | 216 expr.selector is Identifier && |
212 (expr.selector as Identifier).source == Identifiers.noSuchMethod_) { | 217 (expr.selector as Identifier).source == Identifiers.noSuchMethod_) { |
213 var arg = expr.arguments.head; | 218 var arg = expr.arguments.head; |
214 if (expr.arguments.tail.isEmpty && | 219 if (expr.arguments.tail.isEmpty && |
215 arg is Send && | 220 arg is Send && |
216 arg.argumentsNode == null && | 221 arg.argumentsNode == null && |
217 arg.receiver == null && | 222 arg.receiver == null && |
218 arg.selector is Identifier && | 223 arg.selector is Identifier && |
219 arg.selector.source == param) { | 224 arg.selector.source == param) { |
(...skipping 15 matching lines...) Expand all Loading... |
235 if (body.statements.nodes.head is ExpressionStatement) { | 240 if (body.statements.nodes.head is ExpressionStatement) { |
236 ExpressionStatement stmt = body.statements.nodes.head; | 241 ExpressionStatement stmt = body.statements.nodes.head; |
237 return stmt.expression is Throw; | 242 return stmt.expression is Throw; |
238 } | 243 } |
239 } | 244 } |
240 return false; | 245 return false; |
241 } | 246 } |
242 } | 247 } |
243 | 248 |
244 enum NsmCategory { DEFAULT, THROWING, NOT_APPLICABLE, OTHER, } | 249 enum NsmCategory { DEFAULT, THROWING, NOT_APPLICABLE, OTHER, } |
OLD | NEW |