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 import '../common.dart'; | 5 import '../common.dart'; |
6 import '../common/names.dart' show Identifiers, Names, Selectors; | 6 import '../common/names.dart' show Identifiers, Names, Selectors; |
7 import '../common_elements.dart'; | |
8 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
9 import '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
10 import '../types/types.dart'; | 9 import '../types/types.dart'; |
11 import '../tree/tree.dart'; | 10 import '../tree/tree.dart'; |
12 import 'backend_helpers.dart'; | 11 import 'backend_helpers.dart'; |
13 | 12 |
14 /** | 13 /** |
15 * Categorizes `noSuchMethod` implementations. | 14 * Categorizes `noSuchMethod` implementations. |
16 * | 15 * |
17 * If user code includes `noSuchMethod` implementations, type inference is | 16 * If user code includes `noSuchMethod` implementations, type inference is |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void onQueueEmpty() { | 84 void onQueueEmpty() { |
86 _uncategorizedImpls.forEach(_categorizeImpl); | 85 _uncategorizedImpls.forEach(_categorizeImpl); |
87 _uncategorizedImpls.clear(); | 86 _uncategorizedImpls.clear(); |
88 } | 87 } |
89 | 88 |
90 /// Now that type inference is complete, split category D into two | 89 /// Now that type inference is complete, split category D into two |
91 /// subcategories: D1, those that have no return type, and D2, those | 90 /// subcategories: D1, those that have no return type, and D2, those |
92 /// that have a return type. | 91 /// that have a return type. |
93 void onTypeInferenceComplete(GlobalTypeInferenceResults results) { | 92 void onTypeInferenceComplete(GlobalTypeInferenceResults results) { |
94 otherImpls.forEach((FunctionEntity element) { | 93 otherImpls.forEach((FunctionEntity element) { |
95 if (results.resultOfMember(element as MemberEntity).throwsAlways) { | 94 if (results.resultOfMember( |
| 95 // ignore: UNNECESSARY_CAST |
| 96 element as MemberEntity).throwsAlways) { |
96 complexNoReturnImpls.add(element); | 97 complexNoReturnImpls.add(element); |
97 } else { | 98 } else { |
98 complexReturningImpls.add(element); | 99 complexReturningImpls.add(element); |
99 } | 100 } |
100 }); | 101 }); |
101 } | 102 } |
102 | 103 |
103 /// Emits a diagnostic | 104 /// Emits a diagnostic |
104 void emitDiagnostic(DiagnosticReporter reporter) { | 105 void emitDiagnostic(DiagnosticReporter reporter) { |
105 throwingImpls.forEach((e) { | 106 throwingImpls.forEach((e) { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 return stmt.expression is Throw; | 281 return stmt.expression is Throw; |
281 } | 282 } |
282 } | 283 } |
283 return false; | 284 return false; |
284 } | 285 } |
285 | 286 |
286 MethodElement getSuperNoSuchMethod(MethodElement method) { | 287 MethodElement getSuperNoSuchMethod(MethodElement method) { |
287 return method.enclosingClass.lookupSuperByName(Names.noSuchMethod_); | 288 return method.enclosingClass.lookupSuperByName(Names.noSuchMethod_); |
288 } | 289 } |
289 } | 290 } |
OLD | NEW |