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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 1977413002: Improve type information and minor clean up (Closed) Base URL: https://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
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.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 AstNode computeNode() => getNodeMatching((node) => node is AstNode); 2060 AstNode computeNode() => getNodeMatching((node) => node is AstNode);
2061 2061
2062 /** 2062 /**
2063 * Set this element as the enclosing element for given [element]. 2063 * Set this element as the enclosing element for given [element].
2064 */ 2064 */
2065 void encloseElement(ElementImpl element) { 2065 void encloseElement(ElementImpl element) {
2066 element.enclosingElement = this; 2066 element.enclosingElement = this;
2067 } 2067 }
2068 2068
2069 @override 2069 @override
2070 Element getAncestor(Predicate<Element> predicate) { 2070 Element/*=E*/ getAncestor/*<E extends Element >*/(
2071 Predicate<Element> predicate) {
2071 Element ancestor = _enclosingElement; 2072 Element ancestor = _enclosingElement;
2072 while (ancestor != null && !predicate(ancestor)) { 2073 while (ancestor != null && !predicate(ancestor)) {
2073 ancestor = ancestor.enclosingElement; 2074 ancestor = ancestor.enclosingElement;
2074 } 2075 }
2075 return ancestor; 2076 return ancestor as Element/*=E*/;
2076 } 2077 }
2077 2078
2078 /** 2079 /**
2079 * Return the child of this element that is uniquely identified by the given 2080 * Return the child of this element that is uniquely identified by the given
2080 * [identifier], or `null` if there is no such child. 2081 * [identifier], or `null` if there is no such child.
2081 */ 2082 */
2082 ElementImpl getChild(String identifier) => null; 2083 ElementImpl getChild(String identifier) => null;
2083 2084
2084 @override 2085 @override
2085 String getExtendedDisplayName(String shortName) { 2086 String getExtendedDisplayName(String shortName) {
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after
4146 @override 4147 @override
4147 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this); 4148 accept(ElementVisitor visitor) => visitor.visitMultiplyDefinedElement(this);
4148 4149
4149 @override 4150 @override
4150 String computeDocumentationComment() => null; 4151 String computeDocumentationComment() => null;
4151 4152
4152 @override 4153 @override
4153 AstNode computeNode() => null; 4154 AstNode computeNode() => null;
4154 4155
4155 @override 4156 @override
4156 Element getAncestor(Predicate<Element> predicate) => null; 4157 Element/*=E*/ getAncestor/*<E extends Element >*/(
4158 Predicate<Element> predicate) =>
4159 null;
4157 4160
4158 @override 4161 @override
4159 String getExtendedDisplayName(String shortName) { 4162 String getExtendedDisplayName(String shortName) {
4160 if (shortName != null) { 4163 if (shortName != null) {
4161 return shortName; 4164 return shortName;
4162 } 4165 }
4163 return displayName; 4166 return displayName;
4164 } 4167 }
4165 4168
4166 @override 4169 @override
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
4986 4989
4987 @override 4990 @override
4988 void visitElement(Element element) { 4991 void visitElement(Element element) {
4989 int offset = element.nameOffset; 4992 int offset = element.nameOffset;
4990 if (offset != -1) { 4993 if (offset != -1) {
4991 map[offset] = element; 4994 map[offset] = element;
4992 } 4995 }
4993 super.visitElement(element); 4996 super.visitElement(element);
4994 } 4997 }
4995 } 4998 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/ast/utilities.dart ('k') | pkg/analyzer/lib/src/dart/element/handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698