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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1306313002: Implement instance member inference (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 6fe292ae7bb080e3ab0050adf1156820a35d321f..901a8f2a6c5a5fd813962affb14374c2e6010b3c 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -10706,6 +10706,11 @@ class ResolverVisitor extends ScopedVisitor {
@override
Object visitDefaultFormalParameter(DefaultFormalParameter node) {
super.visitDefaultFormalParameter(node);
+ ParameterElement element = node.element;
+ if (element.initializer != null && node.defaultValue != null) {
+ (element.initializer as FunctionElementImpl).returnType =
+ node.defaultValue.staticType;
+ }
FormalParameterList parent = node.parent;
AstNode grandparent = parent.parent;
if (grandparent is ConstructorDeclaration &&
@@ -11131,6 +11136,10 @@ class ResolverVisitor extends ScopedVisitor {
Object visitVariableDeclaration(VariableDeclaration node) {
super.visitVariableDeclaration(node);
VariableElement element = node.element;
+ if (element.initializer != null && node.initializer != null) {
+ (element.initializer as FunctionElementImpl).returnType =
+ node.initializer.staticType;
+ }
// Note: in addition to cloning the initializers for const variables, we
// have to clone the initializers for non-static final fields (because if
// they occur in a class with a const constructor, they will be needed to

Powered by Google App Engine
This is Rietveld 408576698