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

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

Issue 1392383002: further refactoring: merge RestrictedRules into TypeRules (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebase 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 | « no previous file | lib/src/compiler.dart » ('j') | 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 78825d586a4c6c39a19ee5dde8d852886760b794..89362aacad59003789f9355bd4bc8aabb7c49685 100644
--- a/lib/src/checker/rules.dart
+++ b/lib/src/checker/rules.dart
@@ -12,29 +12,20 @@ import '../../strong_mode.dart' show StrongModeOptions;
import '../info.dart';
import '../utils.dart' as utils;
-abstract class TypeRules {
+class TypeRules {
final TypeProvider provider;
/// Map of fields / properties / methods on Object.
final Map<String, DartType> objectMembers;
- TypeRules(TypeProvider provider)
- : provider = provider,
- objectMembers = utils.getObjectMemberMap(provider);
-
- bool isSubTypeOf(DartType t1, DartType t2);
- bool isAssignable(DartType t1, DartType t2);
-
- bool isGroundType(DartType t) => true;
- // TODO(vsm): The default implementation is not ignoring the return type,
- // only the restricted override is.
- bool isFunctionSubTypeOf(FunctionType f1, FunctionType f2,
- {bool fuzzyArrows: true, bool ignoreReturn: false}) =>
- isSubTypeOf(f1, f2);
-
- StaticInfo checkAssignment(Expression expr, DartType t);
+ final StrongModeOptions options;
+ DownwardsInference inferrer;
- DartType getStaticType(Expression expr) => expr.staticType;
+ TypeRules(TypeProvider provider, {this.options})
+ : provider = provider,
+ objectMembers = utils.getObjectMemberMap(provider) {
+ inferrer = new DownwardsInference(this);
+ }
/// Given a type t, if t is an interface type with a call method
/// defined, return the function type for the call method, otherwise
@@ -62,11 +53,6 @@ abstract class TypeRules {
return null;
}
- DartType elementType(Element e);
-
- bool isDynamicTarget(Expression expr);
- bool isDynamicCall(Expression call);
-
/// Gets the expected return type of the given function [body], either from
/// a normal return/yield, or from a yield*.
DartType getExpectedReturnType(FunctionBody body, {bool yieldStar: false}) {
@@ -119,15 +105,6 @@ abstract class TypeRules {
return null;
}
}
-}
-
-class RestrictedRules extends TypeRules {
- final StrongModeOptions options;
- DownwardsInference inferrer;
-
- RestrictedRules(TypeProvider provider, {this.options}) : super(provider) {
- inferrer = new DownwardsInference(this);
- }
DartType getStaticType(Expression expr) {
return expr.staticType ?? provider.dynamicType;
« no previous file with comments | « no previous file | lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698