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

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1956973002: Fix InstanceFieldResolverVisitor to update element model. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.resolver; 5 library analyzer.src.generated.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 4977 matching lines...) Expand 10 before | Expand all | Expand 10 after
4988 _enclosingClassDeclaration = null; 4988 _enclosingClassDeclaration = null;
4989 } 4989 }
4990 } 4990 }
4991 4991
4992 /** 4992 /**
4993 * Resolve the instance fields in the given field declaration [node]. 4993 * Resolve the instance fields in the given field declaration [node].
4994 */ 4994 */
4995 void _resolveFieldDeclaration(FieldDeclaration node) { 4995 void _resolveFieldDeclaration(FieldDeclaration node) {
4996 if (!node.isStatic) { 4996 if (!node.isStatic) {
4997 for (VariableDeclaration field in node.fields.variables) { 4997 for (VariableDeclaration field in node.fields.variables) {
4998 field.initializer?.accept(this); 4998 if (field.initializer != null) {
4999 field.initializer.accept(this);
5000 FieldElement fieldElement = field.name.staticElement;
5001 if (fieldElement.initializer != null) {
5002 (fieldElement.initializer as ExecutableElementImpl).returnType =
5003 field.initializer.staticType;
5004 }
5005 }
4999 } 5006 }
5000 } 5007 }
5001 } 5008 }
5002 } 5009 }
5003 5010
5004 /** 5011 /**
5005 * Instances of the class `OverrideVerifier` visit all of the declarations in a compilation 5012 * Instances of the class `OverrideVerifier` visit all of the declarations in a compilation
5006 * unit to verify that if they have an override annotation it is being used corr ectly. 5013 * unit to verify that if they have an override annotation it is being used corr ectly.
5007 */ 5014 */
5008 class OverrideVerifier extends RecursiveAstVisitor<Object> { 5015 class OverrideVerifier extends RecursiveAstVisitor<Object> {
(...skipping 5880 matching lines...) Expand 10 before | Expand all | Expand 10 after
10889 return null; 10896 return null;
10890 } 10897 }
10891 if (identical(node.staticElement, variable)) { 10898 if (identical(node.staticElement, variable)) {
10892 if (node.inSetterContext()) { 10899 if (node.inSetterContext()) {
10893 result = true; 10900 result = true;
10894 } 10901 }
10895 } 10902 }
10896 return null; 10903 return null;
10897 } 10904 }
10898 } 10905 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698