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

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

Issue 2623453003: Add visitors that throw by default (Closed)
Patch Set: rework implementation Created 3 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
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 /** 5 /**
6 * Defines the element model. The element model describes the semantic (as 6 * Defines the element model. The element model describes the semantic (as
7 * opposed to syntactic) structure of Dart code. The syntactic structure of the 7 * opposed to syntactic) structure of Dart code. The syntactic structure of the
8 * code is modeled by the [AST structure](../ast/ast.dart). 8 * code is modeled by the [AST structure](../ast/ast.dart).
9 * 9 *
10 * The element model consists of two closely related kinds of objects: elements 10 * The element model consists of two closely related kinds of objects: elements
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 * 712 *
713 * This method is expensive, because resolved AST might have been already 713 * This method is expensive, because resolved AST might have been already
714 * evicted from cache, so parsing and resolving will be performed. 714 * evicted from cache, so parsing and resolving will be performed.
715 */ 715 */
716 CompilationUnit get unit; 716 CompilationUnit get unit;
717 717
718 /** 718 /**
719 * Use the given [visitor] to visit this element. Return the value returned by 719 * Use the given [visitor] to visit this element. Return the value returned by
720 * the visitor as a result of visiting this element. 720 * the visitor as a result of visiting this element.
721 */ 721 */
722 /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/> visitor); 722 /*=T*/ accept/*<T>*/(ElementVisitor<dynamic/*=T*/ > visitor);
Paul Berry 2017/01/09 17:36:51 Unintentional change?
Brian Wilkerson 2017/01/09 18:08:07 Yes. The formatter appears to be inserting it, but
Paul Berry 2017/01/09 18:17:56 FYI, Bob: possible formatter bug.
Bob Nystrom 2017/01/11 01:19:38 Hmm, yeah. It tries to handle most of the generic
Paul Berry 2017/01/11 04:17:09 Fair enough. Thanks for checking!
723 723
724 /** 724 /**
725 * Return the documentation comment for this element as it appears in the 725 * Return the documentation comment for this element as it appears in the
726 * original source (complete with the beginning and ending delimiters), or 726 * original source (complete with the beginning and ending delimiters), or
727 * `null` if this element does not have a documentation comment associated 727 * `null` if this element does not have a documentation comment associated
728 * with it. This can be a long-running operation if the information needed to 728 * with it. This can be a long-running operation if the information needed to
729 * access the comment is not cached. 729 * access the comment is not cached.
730 * 730 *
731 * Throws [AnalysisException] if the documentation comment could not be 731 * Throws [AnalysisException] if the documentation comment could not be
732 * determined because the analysis could not be performed 732 * determined because the analysis could not be performed
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 /** 1010 /**
1011 * Return an encoded representation of this location that can be used to 1011 * Return an encoded representation of this location that can be used to
1012 * create a location that is equal to this location. 1012 * create a location that is equal to this location.
1013 */ 1013 */
1014 String get encoding; 1014 String get encoding;
1015 } 1015 }
1016 1016
1017 /** 1017 /**
1018 * An object that can be used to visit an element structure. 1018 * An object that can be used to visit an element structure.
1019 * 1019 *
1020 * Clients may implement this class. 1020 * Clients may not extend, implement or mix-in this class.
1021 */ 1021 */
1022 abstract class ElementVisitor<R> { 1022 abstract class ElementVisitor<R> {
1023 R visitClassElement(ClassElement element); 1023 R visitClassElement(ClassElement element);
1024 1024
1025 R visitCompilationUnitElement(CompilationUnitElement element); 1025 R visitCompilationUnitElement(CompilationUnitElement element);
1026 1026
1027 R visitConstructorElement(ConstructorElement element); 1027 R visitConstructorElement(ConstructorElement element);
1028 1028
1029 R visitExportElement(ExportElement element); 1029 R visitExportElement(ExportElement element);
1030 1030
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 DartType get type; 2029 DartType get type;
2030 2030
2031 /** 2031 /**
2032 * Return a representation of the value of this variable, forcing the value 2032 * Return a representation of the value of this variable, forcing the value
2033 * to be computed if it had not previously been computed, or `null` if either 2033 * to be computed if it had not previously been computed, or `null` if either
2034 * this variable was not declared with the 'const' modifier or if the value of 2034 * this variable was not declared with the 'const' modifier or if the value of
2035 * this variable could not be computed because of errors. 2035 * this variable could not be computed because of errors.
2036 */ 2036 */
2037 DartObject computeConstantValue(); 2037 DartObject computeConstantValue();
2038 } 2038 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698