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

Unified Diff: pkg/analyzer/lib/src/summary/link.dart

Issue 1897843003: Support for extract property for methods. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/link.dart
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index 788f253a7c1fcc844aa7067567f10e2495fde694..2d650e9d4c7ecc5bd84600297ac11247d92745a0 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -3151,10 +3151,15 @@ class NonstaticMemberElementForLink implements ReferenceableElementForLink {
@override
DartType get asStaticType {
Element element = this.element;
- if (element is PropertyAccessorElement && element.isGetter) {
- return element.returnType;
+ if (element is PropertyAccessorElement) {
+ if (element.isGetter) {
+ return element.returnType;
+ }
+ return DynamicTypeImpl.instance;
+ }
+ if (element is MethodElement) {
+ return element.type;
}
- // TODO(paulberry): implement.
return DynamicTypeImpl.instance;
}
@@ -3175,6 +3180,7 @@ class NonstaticMemberElementForLink implements ReferenceableElementForLink {
DartType type = asStaticType;
if (type is InterfaceType) {
Element nameElement = type.lookUpGetter(name, element.library);
+ nameElement ??= type.lookUpMethod(name, element.library);
return new NonstaticMemberElementForLink(nameElement, _constNode);
}
}
@@ -4169,7 +4175,9 @@ class VariableElementForLink
if (linker.strongMode) {
DartType type = asStaticType;
if (type is InterfaceType) {
- return type.lookUpGetter(name, compilationUnit.library);
+ Element result = type.lookUpGetter(name, compilationUnit.library);
+ result ??= type.lookUpMethod(name, compilationUnit.library);
+ return result;
}
}
// TODO(scheglov): implement for propagated types
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/resynthesize_ast_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698