| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 return NsmCategory.THROWING; | 161 return NsmCategory.THROWING; |
| 162 } else { | 162 } else { |
| 163 otherImpls.add(element); | 163 otherImpls.add(element); |
| 164 return NsmCategory.OTHER; | 164 return NsmCategory.OTHER; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 bool _isDefaultNoSuchMethodImplementation(FunctionElement element) { | 168 bool _isDefaultNoSuchMethodImplementation(FunctionElement element) { |
| 169 ClassElement classElement = element.enclosingClass; | 169 ClassElement classElement = element.enclosingClass; |
| 170 return classElement == _compiler.coreClasses.objectClass | 170 return classElement == _compiler.coreClasses.objectClass |
| 171 || classElement == _backend.jsInterceptorClass | 171 || classElement == _backend.helpers.jsInterceptorClass |
| 172 || classElement == _backend.jsNullClass; | 172 || classElement == _backend.helpers.jsNullClass; |
| 173 } | 173 } |
| 174 | 174 |
| 175 bool _hasForwardingSyntax(FunctionElement element) { | 175 bool _hasForwardingSyntax(FunctionElement element) { |
| 176 // At this point we know that this is signature-compatible with | 176 // At this point we know that this is signature-compatible with |
| 177 // Object.noSuchMethod, but it may have more than one argument as long as | 177 // Object.noSuchMethod, but it may have more than one argument as long as |
| 178 // it only has one required argument. | 178 // it only has one required argument. |
| 179 String param = element.parameters.first.name; | 179 String param = element.parameters.first.name; |
| 180 Statement body = element.node.body; | 180 Statement body = element.node.body; |
| 181 Expression expr; | 181 Expression expr; |
| 182 if (body is Return && body.isArrowBody) { | 182 if (body is Return && body.isArrowBody) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 if (body.statements.nodes.head is ExpressionStatement) { | 218 if (body.statements.nodes.head is ExpressionStatement) { |
| 219 ExpressionStatement stmt = body.statements.nodes.head; | 219 ExpressionStatement stmt = body.statements.nodes.head; |
| 220 return stmt.expression is Throw; | 220 return stmt.expression is Throw; |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 return false; | 223 return false; |
| 224 } | 224 } |
| 225 } | 225 } |
| 226 | 226 |
| 227 enum NsmCategory { DEFAULT, THROWING, OTHER } | 227 enum NsmCategory { DEFAULT, THROWING, OTHER } |
| OLD | NEW |