mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
[dart2js] prepare resolution_listener.dart
Change-Id: Ic69113e3640985283dc5ba292b060b9bdbe229d5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262274 Reviewed-by: Nate Biggs <natebiggs@google.com>
This commit is contained in:
parent
b861b0c1e1
commit
7ab05daa4b
3 changed files with 13 additions and 2 deletions
|
@ -52,7 +52,7 @@ import 'no_such_method_registry_interfaces.dart' as interfaces;
|
|||
|
||||
/// Registry for collecting `noSuchMethod` implementations and categorizing them
|
||||
/// into categories `A`, `B`, `C`, `D`.
|
||||
class NoSuchMethodRegistry {
|
||||
class NoSuchMethodRegistry implements interfaces.NoSuchMethodRegistry {
|
||||
/// The implementations that fall into category A, described above.
|
||||
final Set<FunctionEntity> _defaultImpls = {};
|
||||
|
||||
|
@ -82,9 +82,11 @@ class NoSuchMethodRegistry {
|
|||
NoSuchMethodResolver get internalResolverForTesting => _resolver;
|
||||
|
||||
/// `true` if a category `B` method has been seen so far.
|
||||
@override
|
||||
bool get hasThrowingNoSuchMethod => _throwingImpls.isNotEmpty;
|
||||
|
||||
/// `true` if a category `D` method has been seen so far.
|
||||
@override
|
||||
bool get hasComplexNoSuchMethod => _otherImpls.isNotEmpty;
|
||||
|
||||
Iterable<FunctionEntity> get defaultImpls => _defaultImpls;
|
||||
|
@ -94,11 +96,13 @@ class NoSuchMethodRegistry {
|
|||
Iterable<FunctionEntity> get otherImpls => _otherImpls;
|
||||
|
||||
/// Register [noSuchMethodElement].
|
||||
@override
|
||||
void registerNoSuchMethod(FunctionEntity noSuchMethodElement) {
|
||||
_uncategorizedImpls.add(noSuchMethodElement);
|
||||
}
|
||||
|
||||
/// Categorizes the registered methods.
|
||||
@override
|
||||
void onQueueEmpty() {
|
||||
_uncategorizedImpls.forEach(_categorizeImpl);
|
||||
_uncategorizedImpls.clear();
|
||||
|
|
|
@ -4,6 +4,13 @@
|
|||
|
||||
import '../elements/entities.dart';
|
||||
|
||||
abstract class NoSuchMethodRegistry {
|
||||
void registerNoSuchMethod(FunctionEntity noSuchMethodElement);
|
||||
void onQueueEmpty();
|
||||
bool get hasThrowingNoSuchMethod;
|
||||
bool get hasComplexNoSuchMethod;
|
||||
}
|
||||
|
||||
abstract class NoSuchMethodData {
|
||||
bool isComplex(FunctionEntity element);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import 'checked_mode_helpers.dart';
|
|||
import 'custom_elements_analysis.dart';
|
||||
import 'interceptor_data.dart';
|
||||
import 'native_data.dart' show NativeBasicData;
|
||||
import 'no_such_method_registry.dart';
|
||||
import 'no_such_method_registry_interfaces.dart';
|
||||
|
||||
class ResolutionEnqueuerListener extends EnqueuerListener {
|
||||
// TODO(johnniwinther): Avoid the need for this.
|
||||
|
|
Loading…
Reference in a new issue