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

Unified Diff: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart

Issue 2943273002: Implement type inference of getters/setters based on inheritance. (Closed)
Patch Set: Created 3 years, 6 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 | pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
index 278050ae7e0eca761621a55c98b71596d1b9b0aa..16e115fcfb764f49c65edcb60b5094f9fda2fdd8 100644
--- a/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
+++ b/pkg/analyzer/test/src/task/strong/front_end_inference_test.dart
@@ -452,6 +452,23 @@ class _InstrumentationVisitor extends RecursiveAstVisitor<Null> {
}
}
+ @override
+ visitMethodDeclaration(MethodDeclaration node) {
+ super.visitMethodDeclaration(node);
+ if (node.element.enclosingElement is ClassElement) {
+ if (node.isGetter && node.returnType == null) {
+ _recordTopType(node.name.offset, node.element.returnType);
+ }
+ if (node.isSetter) {
+ for (var parameter in node.parameters.parameters) {
+ if (parameter.element.hasImplicitType) {
scheglov 2017/06/18 23:03:43 Would "parameter.type == null" work? It would be c
Paul Berry 2017/06/18 23:34:31 I considered that too, but it wouldn't work becaus
Paul Berry 2017/06/19 18:18:27 After further experimentation it turns out that Pa
+ _recordTopType(parameter.identifier.offset, parameter.element.type);
+ }
+ }
+ }
+ }
+ }
+
visitMethodInvocation(MethodInvocation node) {
super.visitMethodInvocation(node);
if (node.typeArguments == null) {
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698