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

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

Issue 186153005: New analzyer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use meaningful name instead of '_' in predicate. Created 6 years, 9 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 | Annotate | Revision Log
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.index; 8 library engine.index;
9 9
10 import 'dart:collection' show Queue; 10 import 'dart:collection' show Queue;
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 this._store = store; 1229 this._store = store;
1230 _indexContributor = new IndexContributor_AngularHtmlIndexContributor(store, this); 1230 _indexContributor = new IndexContributor_AngularHtmlIndexContributor(store, this);
1231 } 1231 }
1232 1232
1233 void visitExpression(Expression expression) { 1233 void visitExpression(Expression expression) {
1234 // NgFilter 1234 // NgFilter
1235 if (expression is SimpleIdentifier) { 1235 if (expression is SimpleIdentifier) {
1236 SimpleIdentifier identifier = expression; 1236 SimpleIdentifier identifier = expression;
1237 Element element = identifier.bestElement; 1237 Element element = identifier.bestElement;
1238 if (element is AngularElement) { 1238 if (element is AngularElement) {
1239 _store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, cre ateLocation(identifier)); 1239 _store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, cre ateLocationForIdentifier(identifier));
1240 return; 1240 return;
1241 } 1241 }
1242 } 1242 }
1243 // index as a normal Dart expression 1243 // index as a normal Dart expression
1244 expression.accept(_indexContributor); 1244 expression.accept(_indexContributor);
1245 } 1245 }
1246 1246
1247 Object visitHtmlUnit(ht.HtmlUnit node) { 1247 Object visitHtmlUnit(ht.HtmlUnit node) {
1248 _htmlUnitElement = node.element; 1248 _htmlUnitElement = node.element;
1249 CompilationUnitElement dartUnitElement = _htmlUnitElement.angularCompilation Unit; 1249 CompilationUnitElement dartUnitElement = _htmlUnitElement.angularCompilation Unit;
1250 _indexContributor.enterScope(dartUnitElement); 1250 _indexContributor.enterScope(dartUnitElement);
1251 return super.visitHtmlUnit(node); 1251 return super.visitHtmlUnit(node);
1252 } 1252 }
1253 1253
1254 Object visitXmlAttributeNode(ht.XmlAttributeNode node) { 1254 Object visitXmlAttributeNode(ht.XmlAttributeNode node) {
1255 Element element = node.element; 1255 Element element = node.element;
1256 if (element != null) { 1256 if (element != null) {
1257 ht.Token nameToken = node.nameToken; 1257 ht.Token nameToken = node.nameToken;
1258 Location location = createLocation2(nameToken); 1258 Location location = createLocationForToken(nameToken);
1259 _store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, locat ion); 1259 _store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, locat ion);
1260 } 1260 }
1261 return super.visitXmlAttributeNode(node); 1261 return super.visitXmlAttributeNode(node);
1262 } 1262 }
1263 1263
1264 Object visitXmlTagNode(ht.XmlTagNode node) { 1264 Object visitXmlTagNode(ht.XmlTagNode node) {
1265 Element element = node.element; 1265 Element element = node.element;
1266 if (element != null) { 1266 if (element != null) {
1267 // tag 1267 // tag
1268 { 1268 {
1269 ht.Token tagToken = node.tagToken; 1269 ht.Token tagToken = node.tagToken;
1270 Location location = createLocation2(tagToken); 1270 Location location = createLocationForToken(tagToken);
1271 _store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, loc ation); 1271 _store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, loc ation);
1272 } 1272 }
1273 // maybe add closing tag range 1273 // maybe add closing tag range
1274 ht.Token closingTag = node.closingTag; 1274 ht.Token closingTag = node.closingTag;
1275 if (closingTag != null) { 1275 if (closingTag != null) {
1276 Location location = createLocation2(closingTag); 1276 Location location = createLocationForToken(closingTag);
1277 _store.recordRelationship(element, IndexConstants.ANGULAR_CLOSING_TAG_RE FERENCE, location); 1277 _store.recordRelationship(element, IndexConstants.ANGULAR_CLOSING_TAG_RE FERENCE, location);
1278 } 1278 }
1279 } 1279 }
1280 return super.visitXmlTagNode(node); 1280 return super.visitXmlTagNode(node);
1281 } 1281 }
1282 1282
1283 Location createLocation(SimpleIdentifier identifier) => new Location(_htmlUnit Element, identifier.offset, identifier.length); 1283 Location createLocationForIdentifier(SimpleIdentifier identifier) => new Locat ion(_htmlUnitElement, identifier.offset, identifier.length);
1284 1284
1285 Location createLocation2(ht.Token token) => new Location(_htmlUnitElement, tok en.offset, token.length); 1285 Location createLocationForToken(ht.Token token) => new Location(_htmlUnitEleme nt, token.offset, token.length);
1286 } 1286 }
1287 1287
1288 class IndexContributor_AngularHtmlIndexContributor extends IndexContributor { 1288 class IndexContributor_AngularHtmlIndexContributor extends IndexContributor {
1289 final AngularHtmlIndexContributor AngularHtmlIndexContributor_this; 1289 final AngularHtmlIndexContributor AngularHtmlIndexContributor_this;
1290 1290
1291 IndexContributor_AngularHtmlIndexContributor(IndexStore arg0, this.AngularHtml IndexContributor_this) : super(arg0); 1291 IndexContributor_AngularHtmlIndexContributor(IndexStore arg0, this.AngularHtml IndexContributor_this) : super(arg0);
1292 1292
1293 Element peekElement() => AngularHtmlIndexContributor_this._htmlUnitElement; 1293 Element peekElement() => AngularHtmlIndexContributor_this._htmlUnitElement;
1294 1294
1295 void recordRelationship(Element element, Relationship relationship, Location l ocation) { 1295 void recordRelationship(Element element, Relationship relationship, Location l ocation) {
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 } 1540 }
1541 1541
1542 /** 1542 /**
1543 * @return the [ImportElementInfo] with [ImportElement] that is referenced by this 1543 * @return the [ImportElementInfo] with [ImportElement] that is referenced by this
1544 * node with [PrefixElement], may be `null`. 1544 * node with [PrefixElement], may be `null`.
1545 */ 1545 */
1546 static IndexContributor_ImportElementInfo getImportElementInfo(SimpleIdentifie r prefixNode) { 1546 static IndexContributor_ImportElementInfo getImportElementInfo(SimpleIdentifie r prefixNode) {
1547 IndexContributor_ImportElementInfo info = new IndexContributor_ImportElement Info(); 1547 IndexContributor_ImportElementInfo info = new IndexContributor_ImportElement Info();
1548 // prepare environment 1548 // prepare environment
1549 AstNode parent = prefixNode.parent; 1549 AstNode parent = prefixNode.parent;
1550 CompilationUnit unit = prefixNode.getAncestor(CompilationUnit); 1550 CompilationUnit unit = prefixNode.getAncestor((node) => node is CompilationU nit);
1551 LibraryElement libraryElement = unit.element.library; 1551 LibraryElement libraryElement = unit.element.library;
1552 // prepare used element 1552 // prepare used element
1553 Element usedElement = null; 1553 Element usedElement = null;
1554 if (parent is PrefixedIdentifier) { 1554 if (parent is PrefixedIdentifier) {
1555 PrefixedIdentifier prefixed = parent; 1555 PrefixedIdentifier prefixed = parent;
1556 if (identical(prefixed.prefix, prefixNode)) { 1556 if (identical(prefixed.prefix, prefixNode)) {
1557 usedElement = prefixed.staticElement; 1557 usedElement = prefixed.staticElement;
1558 info._periodEnd = prefixed.period.end; 1558 info._periodEnd = prefixed.period.end;
1559 } 1559 }
1560 } 1560 }
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 recordElementDefinition(element, IndexConstants.DEFINES_CLASS); 1820 recordElementDefinition(element, IndexConstants.DEFINES_CLASS);
1821 { 1821 {
1822 ExtendsClause extendsClause = node.extendsClause; 1822 ExtendsClause extendsClause = node.extendsClause;
1823 if (extendsClause != null) { 1823 if (extendsClause != null) {
1824 TypeName superclassNode = extendsClause.superclass; 1824 TypeName superclassNode = extendsClause.superclass;
1825 recordSuperType(superclassNode, IndexConstants.IS_EXTENDED_BY); 1825 recordSuperType(superclassNode, IndexConstants.IS_EXTENDED_BY);
1826 } else { 1826 } else {
1827 InterfaceType superType = element.supertype; 1827 InterfaceType superType = element.supertype;
1828 if (superType != null) { 1828 if (superType != null) {
1829 ClassElement objectElement = superType.element; 1829 ClassElement objectElement = superType.element;
1830 recordRelationship(objectElement, IndexConstants.IS_EXTENDED_BY, cre ateLocation4(node.name.offset, 0)); 1830 recordRelationship(objectElement, IndexConstants.IS_EXTENDED_BY, cre ateLocationFromOffset(node.name.offset, 0));
1831 } 1831 }
1832 } 1832 }
1833 } 1833 }
1834 { 1834 {
1835 WithClause withClause = node.withClause; 1835 WithClause withClause = node.withClause;
1836 if (withClause != null) { 1836 if (withClause != null) {
1837 for (TypeName mixinNode in withClause.mixinTypes) { 1837 for (TypeName mixinNode in withClause.mixinTypes) {
1838 recordSuperType(mixinNode, IndexConstants.IS_MIXED_IN_BY); 1838 recordSuperType(mixinNode, IndexConstants.IS_MIXED_IN_BY);
1839 } 1839 }
1840 } 1840 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 } 1899 }
1900 1900
1901 Object visitConstructorDeclaration(ConstructorDeclaration node) { 1901 Object visitConstructorDeclaration(ConstructorDeclaration node) {
1902 ConstructorElement element = node.element; 1902 ConstructorElement element = node.element;
1903 // define 1903 // define
1904 { 1904 {
1905 Location location; 1905 Location location;
1906 if (node.name != null) { 1906 if (node.name != null) {
1907 int start = node.period.offset; 1907 int start = node.period.offset;
1908 int end = node.name.end; 1908 int end = node.name.end;
1909 location = createLocation4(start, end - start); 1909 location = createLocationFromOffset(start, end - start);
1910 } else { 1910 } else {
1911 int start = node.returnType.end; 1911 int start = node.returnType.end;
1912 location = createLocation4(start, 0); 1912 location = createLocationFromOffset(start, 0);
1913 } 1913 }
1914 recordRelationship(element, IndexConstants.IS_DEFINED_BY, location); 1914 recordRelationship(element, IndexConstants.IS_DEFINED_BY, location);
1915 } 1915 }
1916 // visit children 1916 // visit children
1917 enterScope(element); 1917 enterScope(element);
1918 try { 1918 try {
1919 return super.visitConstructorDeclaration(node); 1919 return super.visitConstructorDeclaration(node);
1920 } finally { 1920 } finally {
1921 exitScope(); 1921 exitScope();
1922 } 1922 }
1923 } 1923 }
1924 1924
1925 Object visitConstructorName(ConstructorName node) { 1925 Object visitConstructorName(ConstructorName node) {
1926 ConstructorElement element = node.staticElement; 1926 ConstructorElement element = node.staticElement;
1927 // in 'class B = A;' actually A constructors are invoked 1927 // in 'class B = A;' actually A constructors are invoked
1928 if (element != null && element.isSynthetic && element.redirectedConstructor != null) { 1928 if (element != null && element.isSynthetic && element.redirectedConstructor != null) {
1929 element = element.redirectedConstructor; 1929 element = element.redirectedConstructor;
1930 } 1930 }
1931 // prepare location 1931 // prepare location
1932 Location location; 1932 Location location;
1933 if (node.name != null) { 1933 if (node.name != null) {
1934 int start = node.period.offset; 1934 int start = node.period.offset;
1935 int end = node.name.end; 1935 int end = node.name.end;
1936 location = createLocation4(start, end - start); 1936 location = createLocationFromOffset(start, end - start);
1937 } else { 1937 } else {
1938 int start = node.type.end; 1938 int start = node.type.end;
1939 location = createLocation4(start, 0); 1939 location = createLocationFromOffset(start, 0);
1940 } 1940 }
1941 // record relationship 1941 // record relationship
1942 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); 1942 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location);
1943 return super.visitConstructorName(node); 1943 return super.visitConstructorName(node);
1944 } 1944 }
1945 1945
1946 Object visitExportDirective(ExportDirective node) { 1946 Object visitExportDirective(ExportDirective node) {
1947 ExportElement element = node.element as ExportElement; 1947 ExportElement element = node.element as ExportElement;
1948 if (element != null) { 1948 if (element != null) {
1949 LibraryElement expLibrary = element.exportedLibrary; 1949 LibraryElement expLibrary = element.exportedLibrary;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 LibraryElement impLibrary = element.importedLibrary; 1985 LibraryElement impLibrary = element.importedLibrary;
1986 recordLibraryReference(node, impLibrary); 1986 recordLibraryReference(node, impLibrary);
1987 } 1987 }
1988 return super.visitImportDirective(node); 1988 return super.visitImportDirective(node);
1989 } 1989 }
1990 1990
1991 Object visitIndexExpression(IndexExpression node) { 1991 Object visitIndexExpression(IndexExpression node) {
1992 MethodElement element = node.bestElement; 1992 MethodElement element = node.bestElement;
1993 if (element is MethodElement) { 1993 if (element is MethodElement) {
1994 Token operator = node.leftBracket; 1994 Token operator = node.leftBracket;
1995 Location location = createLocation5(operator); 1995 Location location = createLocationFromToken(operator);
1996 recordRelationship(element, IndexConstants.IS_INVOKED_BY_QUALIFIED, locati on); 1996 recordRelationship(element, IndexConstants.IS_INVOKED_BY_QUALIFIED, locati on);
1997 } 1997 }
1998 return super.visitIndexExpression(node); 1998 return super.visitIndexExpression(node);
1999 } 1999 }
2000 2000
2001 Object visitMethodDeclaration(MethodDeclaration node) { 2001 Object visitMethodDeclaration(MethodDeclaration node) {
2002 ExecutableElement element = node.element; 2002 ExecutableElement element = node.element;
2003 enterScope(element); 2003 enterScope(element);
2004 try { 2004 try {
2005 return super.visitMethodDeclaration(node); 2005 return super.visitMethodDeclaration(node);
2006 } finally { 2006 } finally {
2007 exitScope(); 2007 exitScope();
2008 } 2008 }
2009 } 2009 }
2010 2010
2011 Object visitMethodInvocation(MethodInvocation node) { 2011 Object visitMethodInvocation(MethodInvocation node) {
2012 SimpleIdentifier name = node.methodName; 2012 SimpleIdentifier name = node.methodName;
2013 Element element = name.bestElement; 2013 Element element = name.bestElement;
2014 if (element is MethodElement) { 2014 if (element is MethodElement) {
2015 Location location = createLocation3(name); 2015 Location location = createLocationFromNode(name);
2016 Relationship relationship; 2016 Relationship relationship;
2017 if (node.target != null) { 2017 if (node.target != null) {
2018 relationship = IndexConstants.IS_INVOKED_BY_QUALIFIED; 2018 relationship = IndexConstants.IS_INVOKED_BY_QUALIFIED;
2019 } else { 2019 } else {
2020 relationship = IndexConstants.IS_INVOKED_BY_UNQUALIFIED; 2020 relationship = IndexConstants.IS_INVOKED_BY_UNQUALIFIED;
2021 } 2021 }
2022 recordRelationship(element, relationship, location); 2022 recordRelationship(element, relationship, location);
2023 } 2023 }
2024 if (element is FunctionElement) { 2024 if (element is FunctionElement) {
2025 Location location = createLocation3(name); 2025 Location location = createLocationFromNode(name);
2026 recordRelationship(element, IndexConstants.IS_INVOKED_BY, location); 2026 recordRelationship(element, IndexConstants.IS_INVOKED_BY, location);
2027 } 2027 }
2028 recordImportElementReferenceWithoutPrefix(name); 2028 recordImportElementReferenceWithoutPrefix(name);
2029 return super.visitMethodInvocation(node); 2029 return super.visitMethodInvocation(node);
2030 } 2030 }
2031 2031
2032 Object visitPartDirective(PartDirective node) { 2032 Object visitPartDirective(PartDirective node) {
2033 Element element = node.element; 2033 Element element = node.element;
2034 Location location = createLocation3(node.uri); 2034 Location location = createLocationFromNode(node.uri);
2035 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); 2035 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location);
2036 return super.visitPartDirective(node); 2036 return super.visitPartDirective(node);
2037 } 2037 }
2038 2038
2039 Object visitPartOfDirective(PartOfDirective node) { 2039 Object visitPartOfDirective(PartOfDirective node) {
2040 Location location = createLocation3(node.libraryName); 2040 Location location = createLocationFromNode(node.libraryName);
2041 recordRelationship(node.element, IndexConstants.IS_REFERENCED_BY, location); 2041 recordRelationship(node.element, IndexConstants.IS_REFERENCED_BY, location);
2042 return null; 2042 return null;
2043 } 2043 }
2044 2044
2045 Object visitPostfixExpression(PostfixExpression node) { 2045 Object visitPostfixExpression(PostfixExpression node) {
2046 recordOperatorReference(node.operator, node.bestElement); 2046 recordOperatorReference(node.operator, node.bestElement);
2047 return super.visitPostfixExpression(node); 2047 return super.visitPostfixExpression(node);
2048 } 2048 }
2049 2049
2050 Object visitPrefixExpression(PrefixExpression node) { 2050 Object visitPrefixExpression(PrefixExpression node) {
2051 recordOperatorReference(node.operator, node.bestElement); 2051 recordOperatorReference(node.operator, node.bestElement);
2052 return super.visitPrefixExpression(node); 2052 return super.visitPrefixExpression(node);
2053 } 2053 }
2054 2054
2055 Object visitSimpleIdentifier(SimpleIdentifier node) { 2055 Object visitSimpleIdentifier(SimpleIdentifier node) {
2056 Element nameElement = new NameElementImpl(node.name); 2056 Element nameElement = new NameElementImpl(node.name);
2057 Location location = createLocation3(node); 2057 Location location = createLocationFromNode(node);
2058 // name in declaration 2058 // name in declaration
2059 if (node.inDeclarationContext()) { 2059 if (node.inDeclarationContext()) {
2060 recordRelationship(nameElement, IndexConstants.IS_DEFINED_BY, location); 2060 recordRelationship(nameElement, IndexConstants.IS_DEFINED_BY, location);
2061 return null; 2061 return null;
2062 } 2062 }
2063 // prepare information 2063 // prepare information
2064 Element element = node.bestElement; 2064 Element element = node.bestElement;
2065 // qualified name reference 2065 // qualified name reference
2066 recordQualifiedMemberReference(node, element, nameElement, location); 2066 recordQualifiedMemberReference(node, element, nameElement, location);
2067 // stop if already handled 2067 // stop if already handled
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2103 recordImportElementReferenceWithoutPrefix(node); 2103 recordImportElementReferenceWithoutPrefix(node);
2104 return super.visitSimpleIdentifier(node); 2104 return super.visitSimpleIdentifier(node);
2105 } 2105 }
2106 2106
2107 Object visitSuperConstructorInvocation(SuperConstructorInvocation node) { 2107 Object visitSuperConstructorInvocation(SuperConstructorInvocation node) {
2108 ConstructorElement element = node.staticElement; 2108 ConstructorElement element = node.staticElement;
2109 Location location; 2109 Location location;
2110 if (node.constructorName != null) { 2110 if (node.constructorName != null) {
2111 int start = node.period.offset; 2111 int start = node.period.offset;
2112 int end = node.constructorName.end; 2112 int end = node.constructorName.end;
2113 location = createLocation4(start, end - start); 2113 location = createLocationFromOffset(start, end - start);
2114 } else { 2114 } else {
2115 int start = node.keyword.end; 2115 int start = node.keyword.end;
2116 location = createLocation4(start, 0); 2116 location = createLocationFromOffset(start, 0);
2117 } 2117 }
2118 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location); 2118 recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location);
2119 return super.visitSuperConstructorInvocation(node); 2119 return super.visitSuperConstructorInvocation(node);
2120 } 2120 }
2121 2121
2122 Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) { 2122 Object visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
2123 VariableDeclarationList variables = node.variables; 2123 VariableDeclarationList variables = node.variables;
2124 for (VariableDeclaration variableDeclaration in variables.variables) { 2124 for (VariableDeclaration variableDeclaration in variables.variables) {
2125 Element element = variableDeclaration.element; 2125 Element element = variableDeclaration.element;
2126 recordElementDefinition(element, IndexConstants.DEFINES_VARIABLE); 2126 recordElementDefinition(element, IndexConstants.DEFINES_VARIABLE);
2127 } 2127 }
2128 return super.visitTopLevelVariableDeclaration(node); 2128 return super.visitTopLevelVariableDeclaration(node);
2129 } 2129 }
2130 2130
2131 Object visitTypeParameter(TypeParameter node) { 2131 Object visitTypeParameter(TypeParameter node) {
2132 TypeParameterElement element = node.element; 2132 TypeParameterElement element = node.element;
2133 enterScope(element); 2133 enterScope(element);
2134 try { 2134 try {
2135 return super.visitTypeParameter(node); 2135 return super.visitTypeParameter(node);
2136 } finally { 2136 } finally {
2137 exitScope(); 2137 exitScope();
2138 } 2138 }
2139 } 2139 }
2140 2140
2141 Object visitVariableDeclaration(VariableDeclaration node) { 2141 Object visitVariableDeclaration(VariableDeclaration node) {
2142 VariableElement element = node.element; 2142 VariableElement element = node.element;
2143 // record declaration 2143 // record declaration
2144 { 2144 {
2145 SimpleIdentifier name = node.name; 2145 SimpleIdentifier name = node.name;
2146 Location location = createLocation3(name); 2146 Location location = createLocationFromNode(name);
2147 location = getLocationWithExpressionType(location, node.initializer); 2147 location = getLocationWithExpressionType(location, node.initializer);
2148 recordRelationship(element, IndexConstants.IS_DEFINED_BY, location); 2148 recordRelationship(element, IndexConstants.IS_DEFINED_BY, location);
2149 } 2149 }
2150 // visit 2150 // visit
2151 enterScope(element); 2151 enterScope(element);
2152 try { 2152 try {
2153 return super.visitVariableDeclaration(node); 2153 return super.visitVariableDeclaration(node);
2154 } finally { 2154 } finally {
2155 exitScope(); 2155 exitScope();
2156 } 2156 }
(...skipping 29 matching lines...) Expand all
2186 */ 2186 */
2187 void recordRelationship(Element element, Relationship relationship, Location l ocation) { 2187 void recordRelationship(Element element, Relationship relationship, Location l ocation) {
2188 if (element != null && location != null) { 2188 if (element != null && location != null) {
2189 _store.recordRelationship(element, relationship, location); 2189 _store.recordRelationship(element, relationship, location);
2190 } 2190 }
2191 } 2191 }
2192 2192
2193 /** 2193 /**
2194 * @return the [Location] representing location of the [AstNode]. 2194 * @return the [Location] representing location of the [AstNode].
2195 */ 2195 */
2196 Location createLocation3(AstNode node) => createLocation4(node.offset, node.le ngth); 2196 Location createLocationFromNode(AstNode node) => createLocationFromOffset(node .offset, node.length);
2197 2197
2198 /** 2198 /**
2199 * @param offset the offset of the location within [Source] 2199 * @param offset the offset of the location within [Source]
2200 * @param length the length of the location 2200 * @param length the length of the location
2201 * @return the [Location] representing the given offset and length within the inner-most 2201 * @return the [Location] representing the given offset and length within the inner-most
2202 * [Element]. 2202 * [Element].
2203 */ 2203 */
2204 Location createLocation4(int offset, int length) { 2204 Location createLocationFromOffset(int offset, int length) {
2205 Element element = peekElement(); 2205 Element element = peekElement();
2206 return new Location(element, offset, length); 2206 return new Location(element, offset, length);
2207 } 2207 }
2208 2208
2209 /** 2209 /**
2210 * @return the [Location] representing location of the [Token]. 2210 * @return the [Location] representing location of the [Token].
2211 */ 2211 */
2212 Location createLocation5(Token token) => createLocation4(token.offset, token.l ength); 2212 Location createLocationFromToken(Token token) => createLocationFromOffset(toke n.offset, token.length);
2213 2213
2214 /** 2214 /**
2215 * Exit the current scope. 2215 * Exit the current scope.
2216 */ 2216 */
2217 void exitScope() { 2217 void exitScope() {
2218 _elementStack.removeFirst(); 2218 _elementStack.removeFirst();
2219 } 2219 }
2220 2220
2221 /** 2221 /**
2222 * @return `true` if given node already indexed as more interesting reference, so it should 2222 * @return `true` if given node already indexed as more interesting reference, so it should
(...skipping 26 matching lines...) Expand all
2249 void recordImportElementReferenceWithoutPrefix(SimpleIdentifier node) { 2249 void recordImportElementReferenceWithoutPrefix(SimpleIdentifier node) {
2250 if (isIdentifierInImportCombinator(node)) { 2250 if (isIdentifierInImportCombinator(node)) {
2251 return; 2251 return;
2252 } 2252 }
2253 if (isIdentifierInPrefixedIdentifier(node)) { 2253 if (isIdentifierInPrefixedIdentifier(node)) {
2254 return; 2254 return;
2255 } 2255 }
2256 Element element = node.staticElement; 2256 Element element = node.staticElement;
2257 ImportElement importElement = getImportElement2(_libraryElement, null, eleme nt, _importElementsMap); 2257 ImportElement importElement = getImportElement2(_libraryElement, null, eleme nt, _importElementsMap);
2258 if (importElement != null) { 2258 if (importElement != null) {
2259 Location location = createLocation4(node.offset, 0); 2259 Location location = createLocationFromOffset(node.offset, 0);
2260 recordRelationship(importElement, IndexConstants.IS_REFERENCED_BY, locatio n); 2260 recordRelationship(importElement, IndexConstants.IS_REFERENCED_BY, locatio n);
2261 } 2261 }
2262 } 2262 }
2263 2263
2264 /** 2264 /**
2265 * Records [ImportElement] that declares given prefix and imports library with element used 2265 * Records [ImportElement] that declares given prefix and imports library with element used
2266 * with given prefix node. 2266 * with given prefix node.
2267 */ 2267 */
2268 void recordImportElementReferenceWithPrefix(SimpleIdentifier prefixNode) { 2268 void recordImportElementReferenceWithPrefix(SimpleIdentifier prefixNode) {
2269 IndexContributor_ImportElementInfo info = getImportElementInfo(prefixNode); 2269 IndexContributor_ImportElementInfo info = getImportElementInfo(prefixNode);
2270 if (info != null) { 2270 if (info != null) {
2271 int offset = prefixNode.offset; 2271 int offset = prefixNode.offset;
2272 int length = info._periodEnd - offset; 2272 int length = info._periodEnd - offset;
2273 Location location = createLocation4(offset, length); 2273 Location location = createLocationFromOffset(offset, length);
2274 recordRelationship(info._element, IndexConstants.IS_REFERENCED_BY, locatio n); 2274 recordRelationship(info._element, IndexConstants.IS_REFERENCED_BY, locatio n);
2275 } 2275 }
2276 } 2276 }
2277 2277
2278 /** 2278 /**
2279 * Records reference to defining [CompilationUnitElement] of the given 2279 * Records reference to defining [CompilationUnitElement] of the given
2280 * [LibraryElement]. 2280 * [LibraryElement].
2281 */ 2281 */
2282 void recordLibraryReference(UriBasedDirective node, LibraryElement library) { 2282 void recordLibraryReference(UriBasedDirective node, LibraryElement library) {
2283 if (library != null) { 2283 if (library != null) {
2284 Location location = createLocation3(node.uri); 2284 Location location = createLocationFromNode(node.uri);
2285 recordRelationship(library.definingCompilationUnit, IndexConstants.IS_REFE RENCED_BY, location); 2285 recordRelationship(library.definingCompilationUnit, IndexConstants.IS_REFE RENCED_BY, location);
2286 } 2286 }
2287 } 2287 }
2288 2288
2289 /** 2289 /**
2290 * Record reference to the given operator [Element] and name. 2290 * Record reference to the given operator [Element] and name.
2291 */ 2291 */
2292 void recordOperatorReference(Token operator, Element element) { 2292 void recordOperatorReference(Token operator, Element element) {
2293 // prepare location 2293 // prepare location
2294 Location location = createLocation5(operator); 2294 Location location = createLocationFromToken(operator);
2295 // record name reference 2295 // record name reference
2296 { 2296 {
2297 String name = operator.lexeme; 2297 String name = operator.lexeme;
2298 if (name == "++") { 2298 if (name == "++") {
2299 name = "+"; 2299 name = "+";
2300 } 2300 }
2301 if (name == "--") { 2301 if (name == "--") {
2302 name = "-"; 2302 name = "-";
2303 } 2303 }
2304 if (StringUtilities.endsWithChar(name, 0x3D) && name != "==") { 2304 if (StringUtilities.endsWithChar(name, 0x3D) && name != "==") {
(...skipping 22 matching lines...) Expand all
2327 2327
2328 /** 2328 /**
2329 * Records extends/implements relationships between given [ClassElement] and [ Type] of 2329 * Records extends/implements relationships between given [ClassElement] and [ Type] of
2330 * "superNode". 2330 * "superNode".
2331 */ 2331 */
2332 void recordSuperType(TypeName superNode, Relationship relationship) { 2332 void recordSuperType(TypeName superNode, Relationship relationship) {
2333 if (superNode != null) { 2333 if (superNode != null) {
2334 Identifier superName = superNode.name; 2334 Identifier superName = superNode.name;
2335 if (superName != null) { 2335 if (superName != null) {
2336 Element superElement = superName.staticElement; 2336 Element superElement = superName.staticElement;
2337 recordRelationship(superElement, relationship, createLocation3(superNode )); 2337 recordRelationship(superElement, relationship, createLocationFromNode(su perNode));
2338 } 2338 }
2339 } 2339 }
2340 } 2340 }
2341 } 2341 }
2342 2342
2343 /** 2343 /**
2344 * Information about [ImportElement] and place where it is referenced using 2344 * Information about [ImportElement] and place where it is referenced using
2345 * [PrefixElement]. 2345 * [PrefixElement].
2346 */ 2346 */
2347 class IndexContributor_ImportElementInfo { 2347 class IndexContributor_ImportElementInfo {
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 * element are available. For example, if the element is a field and the relat ionship is the 2818 * element are available. For example, if the element is a field and the relat ionship is the
2819 * is-referenced-by relationship, then this method will be invoked with each l ocation at which the 2819 * is-referenced-by relationship, then this method will be invoked with each l ocation at which the
2820 * field is referenced. 2820 * field is referenced.
2821 * 2821 *
2822 * @param element the [Element] that has the relationship with the locations 2822 * @param element the [Element] that has the relationship with the locations
2823 * @param relationship the relationship between the given element and the loca tions 2823 * @param relationship the relationship between the given element and the loca tions
2824 * @param locations the locations that were found 2824 * @param locations the locations that were found
2825 */ 2825 */
2826 void hasRelationships(Element element, Relationship relationship, List<Locatio n> locations); 2826 void hasRelationships(Element element, Relationship relationship, List<Locatio n> locations);
2827 } 2827 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/error.dart ('k') | pkg/analyzer/lib/src/generated/java_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698