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

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

Issue 1296723002: Cleanup InferableOverride (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Fix format Created 5 years, 4 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/info.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/checker/checker.dart
diff --git a/lib/src/checker/checker.dart b/lib/src/checker/checker.dart
index 96c2d1d401915ce6e851247061e667418c0f2b10..e0e4d11d41327a47ca11bd48271a63058aa2637e 100644
--- a/lib/src/checker/checker.dart
+++ b/lib/src/checker/checker.dart
@@ -295,34 +295,12 @@ class _OverrideChecker {
// get foo => e; // no type specified.
// toString() { ... } // no return type specified.
// }
- if (_isInferableOverride(element, node, subType, baseType)) {
- _recordMessage(new InferableOverride(errorLocation, element, type,
- subType.returnType, baseType.returnType));
- } else {
- _recordMessage(new InvalidMethodOverride(
- errorLocation, element, type, subType, baseType));
- }
+ _recordMessage(new InvalidMethodOverride(
+ errorLocation, element, type, subType, baseType));
}
return true;
}
- bool _isInferableOverride(ExecutableElement element, AstNode node,
- FunctionType subType, FunctionType baseType) {
- if (_inferFromOverrides || node == null) return false;
- final isGetter = element is PropertyAccessorElement && element.isGetter;
- if (isGetter && element.isSynthetic) {
- var field = node.parent.parent;
- return field is FieldDeclaration && field.fields.type == null;
- }
-
- // node is a MethodDeclaration whenever getters and setters are
- // declared explicitly. Setters declared from a field will have the
- // correct return type, so we don't need to check that separately.
- return node is MethodDeclaration &&
- node.returnType == null &&
- _rules.isFunctionSubTypeOf(subType, baseType, ignoreReturn: true);
- }
-
void _recordMessage(StaticInfo info) {
if (info == null) return;
var error = info.toAnalysisError();
« no previous file with comments | « no previous file | lib/src/info.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698