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

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

Issue 1512833007: A class that's only used as a field type should be considered used (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/generated/resolver_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 engine.resolver; 5 library engine.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import '../task/strong/info.dart' show InferredType, StaticInfo; 9 import '../task/strong/info.dart' show InferredType, StaticInfo;
10 import 'ast.dart'; 10 import 'ast.dart';
(...skipping 4904 matching lines...) Expand 10 before | Expand all | Expand 10 after
4915 return; 4915 return;
4916 } 4916 }
4917 // ignore places where the element is not actually used 4917 // ignore places where the element is not actually used
4918 if (node.parent is TypeName) { 4918 if (node.parent is TypeName) {
4919 if (element is ClassElement) { 4919 if (element is ClassElement) {
4920 AstNode parent2 = node.parent.parent; 4920 AstNode parent2 = node.parent.parent;
4921 if (parent2 is IsExpression) { 4921 if (parent2 is IsExpression) {
4922 return; 4922 return;
4923 } 4923 }
4924 if (parent2 is VariableDeclarationList) { 4924 if (parent2 is VariableDeclarationList) {
4925 return; 4925 // If it's a field's type, it still counts as used.
4926 if (parent2.parent is! FieldDeclaration) {
4927 return;
4928 }
4926 } 4929 }
4927 } 4930 }
4928 } 4931 }
4929 // OK 4932 // OK
4930 usedElements.addElement(element); 4933 usedElements.addElement(element);
4931 } 4934 }
4932 4935
4933 static bool _isReadIdentifier(SimpleIdentifier node) { 4936 static bool _isReadIdentifier(SimpleIdentifier node) {
4934 // not reading at all 4937 // not reading at all
4935 if (!node.inGetterContext()) { 4938 if (!node.inGetterContext()) {
(...skipping 8380 matching lines...) Expand 10 before | Expand all | Expand 10 after
13316 nonFields.add(node); 13319 nonFields.add(node);
13317 return null; 13320 return null;
13318 } 13321 }
13319 13322
13320 @override 13323 @override
13321 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 13324 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
13322 13325
13323 @override 13326 @override
13324 Object visitWithClause(WithClause node) => null; 13327 Object visitWithClause(WithClause node) => null;
13325 } 13328 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698