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

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

Issue 2047523002: Supertype checking cleanup. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 // return true; 979 // return true;
980 // } 980 // }
981 // } 981 // }
982 // return false; 982 // return false;
983 // } 983 // }
984 984
985 bool _hasTypeOrSuperType(ClassElement element, InterfaceType type) { 985 bool _hasTypeOrSuperType(ClassElement element, InterfaceType type) {
986 if (element == null) { 986 if (element == null) {
987 return false; 987 return false;
988 } 988 }
989 if (element.type == type) {
990 return true;
991 }
992 ClassElement typeElement = type.element; 989 ClassElement typeElement = type.element;
993 return element.allSupertypes 990 return element == typeElement ||
994 .any((InterfaceType t) => t.element == typeElement); 991 element.allSupertypes
992 .any((InterfaceType t) => t.element == typeElement);
995 } 993 }
996 994
997 /** 995 /**
998 * Given a parenthesized expression, this returns the parent (or recursively g rand-parent) of the 996 * Given a parenthesized expression, this returns the parent (or recursively g rand-parent) of the
999 * expression that is a parenthesized expression, but whose parent is not a pa renthesized 997 * expression that is a parenthesized expression, but whose parent is not a pa renthesized
1000 * expression. 998 * expression.
1001 * 999 *
1002 * For example given the code `(((e)))`: `(e) -> (((e)))`. 1000 * For example given the code `(((e)))`: `(e) -> (((e)))`.
1003 * 1001 *
1004 * @param parenthesizedExpression some expression whose parent is a parenthesi zed expression 1002 * @param parenthesizedExpression some expression whose parent is a parenthesi zed expression
(...skipping 9927 matching lines...) Expand 10 before | Expand all | Expand 10 after
10932 return null; 10930 return null;
10933 } 10931 }
10934 if (identical(node.staticElement, variable)) { 10932 if (identical(node.staticElement, variable)) {
10935 if (node.inSetterContext()) { 10933 if (node.inSetterContext()) {
10936 result = true; 10934 result = true;
10937 } 10935 }
10938 } 10936 }
10939 return null; 10937 return null;
10940 } 10938 }
10941 } 10939 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698