| Index: lib/src/checker/rules.dart
|
| diff --git a/lib/src/checker/rules.dart b/lib/src/checker/rules.dart
|
| index ef09d3b871cb37a522590947b52d22e2cb31f900..1cf9270e0c66f0c2035eedca0c8d38d44b493088 100644
|
| --- a/lib/src/checker/rules.dart
|
| +++ b/lib/src/checker/rules.dart
|
| @@ -10,7 +10,6 @@ import 'package:analyzer/src/generated/resolver.dart';
|
|
|
| import 'package:dev_compiler/src/info.dart';
|
| import 'package:dev_compiler/src/options.dart';
|
| -import 'package:dev_compiler/src/report.dart' show CheckerReporter;
|
|
|
| abstract class TypeRules {
|
| final TypeProvider provider;
|
| @@ -18,6 +17,8 @@ abstract class TypeRules {
|
|
|
| TypeRules(TypeProvider this.provider);
|
|
|
| + MissingTypeReporter reportMissingType;
|
| +
|
| bool isSubTypeOf(DartType t1, DartType t2);
|
| bool isAssignable(DartType t1, DartType t2);
|
|
|
| @@ -51,6 +52,8 @@ abstract class TypeRules {
|
| class DartRules extends TypeRules {
|
| DartRules(TypeProvider provider) : super(provider);
|
|
|
| + MissingTypeReporter reportMissingType = null;
|
| +
|
| bool isSubTypeOf(DartType t1, DartType t2) {
|
| return t1.isSubtypeOf(t2);
|
| }
|
| @@ -79,8 +82,10 @@ class DartRules extends TypeRules {
|
| bool isDynamicCall(Expression call) => true;
|
| }
|
|
|
| +typedef void MissingTypeReporter(Expression expr);
|
| +
|
| class RestrictedRules extends TypeRules {
|
| - final CheckerReporter _reporter;
|
| + MissingTypeReporter reportMissingType = null;
|
| final RulesOptions options;
|
| final List<DartType> _nonnullableTypes;
|
| DownwardsInference inferrer;
|
| @@ -102,7 +107,7 @@ class RestrictedRules extends TypeRules {
|
| }
|
| }
|
|
|
| - RestrictedRules(TypeProvider provider, this._reporter, {this.options})
|
| + RestrictedRules(TypeProvider provider, {this.options})
|
| : _nonnullableTypes = <DartType>[],
|
| super(provider) {
|
| var types = options.nonnullableTypes;
|
| @@ -113,7 +118,7 @@ class RestrictedRules extends TypeRules {
|
| DartType getStaticType(Expression expr) {
|
| var type = expr.staticType;
|
| if (type != null) return type;
|
| - _reporter.log(new MissingTypeError(expr));
|
| + if (reportMissingType != null) reportMissingType(expr);
|
| return provider.dynamicType;
|
| }
|
|
|
|
|