| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 otherImpls.add(element); | 133 otherImpls.add(element); |
| 134 return NsmCategory.OTHER; | 134 return NsmCategory.OTHER; |
| 135 } | 135 } |
| 136 if (_isDefaultNoSuchMethodImplementation(element)) { | 136 if (_isDefaultNoSuchMethodImplementation(element)) { |
| 137 defaultImpls.add(element); | 137 defaultImpls.add(element); |
| 138 return NsmCategory.DEFAULT; | 138 return NsmCategory.DEFAULT; |
| 139 } else if (_hasForwardingSyntax(element)) { | 139 } else if (_hasForwardingSyntax(element)) { |
| 140 // If the implementation is 'noSuchMethod(x) => super.noSuchMethod(x);' | 140 // If the implementation is 'noSuchMethod(x) => super.noSuchMethod(x);' |
| 141 // then it is in the same category as the super call. | 141 // then it is in the same category as the super call. |
| 142 Element superCall = element.enclosingClass | 142 Element superCall = element.enclosingClass |
| 143 .lookupSuperSelector(_compiler.noSuchMethodSelector); | 143 .lookupSuperByName(_compiler.noSuchMethodSelector.memberName); |
| 144 NsmCategory category = _categorizeImpl(superCall); | 144 NsmCategory category = _categorizeImpl(superCall); |
| 145 switch(category) { | 145 switch(category) { |
| 146 case NsmCategory.DEFAULT: | 146 case NsmCategory.DEFAULT: |
| 147 defaultImpls.add(element); | 147 defaultImpls.add(element); |
| 148 break; | 148 break; |
| 149 case NsmCategory.THROWING: | 149 case NsmCategory.THROWING: |
| 150 throwingImpls.add(element); | 150 throwingImpls.add(element); |
| 151 break; | 151 break; |
| 152 case NsmCategory.OTHER: | 152 case NsmCategory.OTHER: |
| 153 otherImpls.add(element); | 153 otherImpls.add(element); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 if (body.statements.nodes.head is ExpressionStatement) { | 216 if (body.statements.nodes.head is ExpressionStatement) { |
| 217 ExpressionStatement stmt = body.statements.nodes.head; | 217 ExpressionStatement stmt = body.statements.nodes.head; |
| 218 return stmt.expression is Throw; | 218 return stmt.expression is Throw; |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 return false; | 221 return false; |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 enum NsmCategory { DEFAULT, THROWING, OTHER } | 225 enum NsmCategory { DEFAULT, THROWING, OTHER } |
| OLD | NEW |