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

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

Issue 135653008: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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.ast; 8 library engine.ast;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 9991 matching lines...) Expand 10 before | Expand all | Expand 10 after
10002 10002
10003 /** 10003 /**
10004 * Return the given element if it is an appropriate element based on the paren t of this 10004 * Return the given element if it is an appropriate element based on the paren t of this
10005 * identifier, or `null` if it is not appropriate. 10005 * identifier, or `null` if it is not appropriate.
10006 * 10006 *
10007 * @param element the element to be associated with this identifier 10007 * @param element the element to be associated with this identifier
10008 * @return the element to be associated with this identifier 10008 * @return the element to be associated with this identifier
10009 */ 10009 */
10010 Element validateElement(ASTNode parent, Type expectedClass, Element element) { 10010 Element validateElement(ASTNode parent, Type expectedClass, Element element) {
10011 if (!isInstanceOf(element, expectedClass)) { 10011 if (!isInstanceOf(element, expectedClass)) {
10012 AnalysisEngine.instance.logger.logInformation2("Internal error: attempting to set the name of a ${parent.runtimeType.toString()} to a ${element.runtimeTyp e.toString()}", new JavaException()); 10012 AnalysisEngine.instance.logger.logInformation3("Internal error: attempting to set the name of a ${parent.runtimeType.toString()} to a ${element.runtimeTyp e.toString()}", new JavaException());
10013 return null; 10013 return null;
10014 } 10014 }
10015 return element; 10015 return element;
10016 } 10016 }
10017 10017
10018 /** 10018 /**
10019 * Return the given element if it is an appropriate element based on the paren t of this 10019 * Return the given element if it is an appropriate element based on the paren t of this
10020 * identifier, or `null` if it is not appropriate. 10020 * identifier, or `null` if it is not appropriate.
10021 * 10021 *
10022 * @param element the element to be associated with this identifier 10022 * @param element the element to be associated with this identifier
(...skipping 2339 matching lines...) Expand 10 before | Expand all | Expand 10 after
12362 Element visitClassDeclaration(ClassDeclaration node) => node.element; 12362 Element visitClassDeclaration(ClassDeclaration node) => node.element;
12363 12363
12364 Element visitCompilationUnit(CompilationUnit node) => node.element; 12364 Element visitCompilationUnit(CompilationUnit node) => node.element;
12365 12365
12366 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme nt; 12366 Element visitConstructorDeclaration(ConstructorDeclaration node) => node.eleme nt;
12367 12367
12368 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element; 12368 Element visitFunctionDeclaration(FunctionDeclaration node) => node.element;
12369 12369
12370 Element visitIdentifier(Identifier node) { 12370 Element visitIdentifier(Identifier node) {
12371 ASTNode parent = node.parent; 12371 ASTNode parent = node.parent;
12372 // Type name in InstanceCreationExpression
12373 {
12374 ASTNode typeNameCandidate = parent;
12375 // new prefix.node[.constructorName]()
12376 if (typeNameCandidate is PrefixedIdentifier) {
12377 PrefixedIdentifier prefixedIdentifier = typeNameCandidate as PrefixedIde ntifier;
12378 if (identical(prefixedIdentifier.identifier, node)) {
12379 typeNameCandidate = prefixedIdentifier.parent;
12380 }
12381 }
12382 // new typeName[.constructorName]()
12383 if (typeNameCandidate is TypeName) {
12384 TypeName typeName = typeNameCandidate as TypeName;
12385 if (typeName.parent is ConstructorName) {
12386 ConstructorName constructorName = typeName.parent as ConstructorName;
12387 return constructorName.staticElement;
12388 }
12389 }
12390 }
12372 // Extra work to map Constructor Declarations to their associated Constructo r Elements 12391 // Extra work to map Constructor Declarations to their associated Constructo r Elements
12373 if (parent is ConstructorDeclaration) { 12392 if (parent is ConstructorDeclaration) {
12374 ConstructorDeclaration decl = parent; 12393 ConstructorDeclaration decl = parent;
12375 Identifier returnType = decl.returnType; 12394 Identifier returnType = decl.returnType;
12376 if (identical(returnType, node)) { 12395 if (identical(returnType, node)) {
12377 SimpleIdentifier name = decl.name; 12396 SimpleIdentifier name = decl.name;
12378 if (name != null) { 12397 if (name != null) {
12379 return name.bestElement; 12398 return name.bestElement;
12380 } 12399 }
12381 Element element = node.bestElement; 12400 Element element = node.bestElement;
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
12764 * @return the element that was found 12783 * @return the element that was found
12765 */ 12784 */
12766 ASTNode searchWithin(ASTNode node) { 12785 ASTNode searchWithin(ASTNode node) {
12767 if (node == null) { 12786 if (node == null) {
12768 return null; 12787 return null;
12769 } 12788 }
12770 try { 12789 try {
12771 node.accept(this); 12790 node.accept(this);
12772 } on NodeLocator_NodeFoundException catch (exception) { 12791 } on NodeLocator_NodeFoundException catch (exception) {
12773 } on JavaException catch (exception) { 12792 } on JavaException catch (exception) {
12774 AnalysisEngine.instance.logger.logInformation2("Unable to locate element a t offset (${_startOffset} - ${_endOffset})", exception); 12793 AnalysisEngine.instance.logger.logInformation3("Unable to locate element a t offset (${_startOffset} - ${_endOffset})", exception);
12775 return null; 12794 return null;
12776 } 12795 }
12777 return _foundNode; 12796 return _foundNode;
12778 } 12797 }
12779 12798
12780 Object visitNode(ASTNode node) { 12799 Object visitNode(ASTNode node) {
12781 int start = node.offset; 12800 int start = node.offset;
12782 int end = start + node.length; 12801 int end = start + node.length;
12783 if (end < _startOffset) { 12802 if (end < _startOffset) {
12784 return null; 12803 return null;
12785 } 12804 }
12786 if (start > _endOffset) { 12805 if (start > _endOffset) {
12787 return null; 12806 return null;
12788 } 12807 }
12789 try { 12808 try {
12790 node.visitChildren(this); 12809 node.visitChildren(this);
12791 } on NodeLocator_NodeFoundException catch (exception) { 12810 } on NodeLocator_NodeFoundException catch (exception) {
12792 throw exception; 12811 throw exception;
12793 } on JavaException catch (exception) { 12812 } on JavaException catch (exception) {
12794 // Ignore the exception and proceed in order to visit the rest of the stru cture. 12813 // Ignore the exception and proceed in order to visit the rest of the stru cture.
12795 AnalysisEngine.instance.logger.logInformation2("Exception caught while tra versing an AST structure.", exception); 12814 AnalysisEngine.instance.logger.logInformation3("Exception caught while tra versing an AST structure.", exception);
12796 } 12815 }
12797 if (start <= _startOffset && _endOffset <= end) { 12816 if (start <= _startOffset && _endOffset <= end) {
12798 _foundNode = node; 12817 _foundNode = node;
12799 throw new NodeLocator_NodeFoundException(); 12818 throw new NodeLocator_NodeFoundException();
12800 } 12819 }
12801 return null; 12820 return null;
12802 } 12821 }
12803 } 12822 }
12804 12823
12805 /** 12824 /**
(...skipping 3632 matching lines...) Expand 10 before | Expand all | Expand 10 after
16438 } 16457 }
16439 void operator[]=(int index, E node) { 16458 void operator[]=(int index, E node) {
16440 if (index < 0 || index >= _elements.length) { 16459 if (index < 0 || index >= _elements.length) {
16441 throw new RangeError("Index: ${index}, Size: ${_elements.length}"); 16460 throw new RangeError("Index: ${index}, Size: ${_elements.length}");
16442 } 16461 }
16443 owner.becomeParentOf(node); 16462 owner.becomeParentOf(node);
16444 _elements[index] = node; 16463 _elements[index] = node;
16445 } 16464 }
16446 int get length => _elements.length; 16465 int get length => _elements.length;
16447 } 16466 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698