Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(519)

Unified Diff: lib/src/checker/rules.dart

Issue 1390903004: more housecleaning: remove DartRules and reportMissingType (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/checker/checker.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/checker/rules.dart
diff --git a/lib/src/checker/rules.dart b/lib/src/checker/rules.dart
index b32163dbbfce94d76aa1ddda4f0af4d81d23c016..35999f096b110431d62470c5c89b027289ca5086 100644
--- a/lib/src/checker/rules.dart
+++ b/lib/src/checker/rules.dart
@@ -22,8 +22,6 @@ abstract class TypeRules {
: provider = provider,
objectMembers = utils.getObjectMemberMap(provider);
- MissingTypeReporter reportMissingType;
-
bool isSubTypeOf(DartType t1, DartType t2);
bool isAssignable(DartType t1, DartType t2);
@@ -140,42 +138,7 @@ abstract class TypeRules {
}
}
-// TODO(jmesserly): this is unused.
-class DartRules extends TypeRules {
- DartRules(TypeProvider provider) : super(provider);
-
- MissingTypeReporter reportMissingType = null;
-
- bool isSubTypeOf(DartType t1, DartType t2) {
- return t1.isSubtypeOf(t2);
- }
-
- bool isAssignable(DartType t1, DartType t2) {
- return t1.isAssignableTo(t2);
- }
-
- StaticInfo checkAssignment(Expression expr, DartType toType) {
- final fromType = getStaticType(expr);
- if (!isAssignable(fromType, toType)) {
- return new StaticTypeError(this, expr, toType);
- }
- return null;
- }
-
- DartType elementType(Element e) {
- return (e as dynamic).type;
- }
-
- /// By default, all invocations are dynamic in Dart.
- bool isDynamic(DartType t) => true;
- bool isDynamicTarget(Expression expr) => true;
- bool isDynamicCall(Expression call) => true;
-}
-
-typedef void MissingTypeReporter(Expression expr);
-
class RestrictedRules extends TypeRules {
- MissingTypeReporter reportMissingType = null;
final StrongModeOptions options;
final List<DartType> _nonnullableTypes;
DownwardsInference inferrer;
@@ -206,10 +169,7 @@ class RestrictedRules extends TypeRules {
}
DartType getStaticType(Expression expr) {
- var type = expr.staticType;
- if (type != null) return type;
- if (reportMissingType != null) reportMissingType(expr);
- return provider.dynamicType;
+ return expr.staticType ?? provider.dynamicType;
}
bool _isBottom(DartType t, {bool dynamicIsBottom: false}) {
« no previous file with comments | « lib/src/checker/checker.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698