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

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

Issue 200583002: Analyzer snapshot with disabled 'this.field' generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | 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 // 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.resolver; 8 library engine.resolver;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 7653 matching lines...) Expand 10 before | Expand all | Expand 10 after
7664 /** 7664 /**
7665 * Instances of the class `SyntheticIdentifier` implement an identifier that can be used to 7665 * Instances of the class `SyntheticIdentifier` implement an identifier that can be used to
7666 * look up names in the lexical scope when there is no identifier in the AST str ucture. There is 7666 * look up names in the lexical scope when there is no identifier in the AST str ucture. There is
7667 * no identifier in the AST when the parser could not distinguish between a meth od invocation and 7667 * no identifier in the AST when the parser could not distinguish between a meth od invocation and
7668 * an invocation of a top-level function imported with a prefix. 7668 * an invocation of a top-level function imported with a prefix.
7669 */ 7669 */
7670 class ElementResolver_SyntheticIdentifier extends Identifier { 7670 class ElementResolver_SyntheticIdentifier extends Identifier {
7671 /** 7671 /**
7672 * The name of the synthetic identifier. 7672 * The name of the synthetic identifier.
7673 */ 7673 */
7674 final String name; 7674 String name;
7675 7675
7676 /** 7676 /**
7677 * Initialize a newly created synthetic identifier to have the given name. 7677 * Initialize a newly created synthetic identifier to have the given name.
7678 * 7678 *
7679 * @param name the name of the synthetic identifier 7679 * @param name the name of the synthetic identifier
7680 */ 7680 */
7681 ElementResolver_SyntheticIdentifier(this.name); 7681 ElementResolver_SyntheticIdentifier(String name) {
7682 this.name = name;
7683 }
7682 7684
7683 @override 7685 @override
7684 accept(AstVisitor visitor) => null; 7686 accept(AstVisitor visitor) => null;
7685 7687
7686 @override 7688 @override
7687 sc.Token get beginToken => null; 7689 sc.Token get beginToken => null;
7688 7690
7689 @override 7691 @override
7690 Element get bestElement => null; 7692 Element get bestElement => null;
7691 7693
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
8724 InheritanceManager _inheritanceManager; 8726 InheritanceManager _inheritanceManager;
8725 8727
8726 /** 8728 /**
8727 * The listener to which analysis errors will be reported. 8729 * The listener to which analysis errors will be reported.
8728 */ 8730 */
8729 AnalysisErrorListener _errorListener; 8731 AnalysisErrorListener _errorListener;
8730 8732
8731 /** 8733 /**
8732 * The source specifying the defining compilation unit of this library. 8734 * The source specifying the defining compilation unit of this library.
8733 */ 8735 */
8734 final Source librarySource; 8736 Source librarySource;
8735 8737
8736 /** 8738 /**
8737 * The library element representing this library. 8739 * The library element representing this library.
8738 */ 8740 */
8739 LibraryElementImpl _libraryElement; 8741 LibraryElementImpl _libraryElement;
8740 8742
8741 /** 8743 /**
8742 * A list containing all of the libraries that are imported into this library. 8744 * A list containing all of the libraries that are imported into this library.
8743 */ 8745 */
8744 List<Library> _importedLibraries = _EMPTY_ARRAY; 8746 List<Library> _importedLibraries = _EMPTY_ARRAY;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
8779 */ 8781 */
8780 static String _DART_EXT_SCHEME = "dart-ext:"; 8782 static String _DART_EXT_SCHEME = "dart-ext:";
8781 8783
8782 /** 8784 /**
8783 * Initialize a newly created data holder that can maintain the data associate d with a library. 8785 * Initialize a newly created data holder that can maintain the data associate d with a library.
8784 * 8786 *
8785 * @param analysisContext the analysis context in which this library is being analyzed 8787 * @param analysisContext the analysis context in which this library is being analyzed
8786 * @param errorListener the listener to which analysis errors will be reported 8788 * @param errorListener the listener to which analysis errors will be reported
8787 * @param librarySource the source specifying the defining compilation unit of this library 8789 * @param librarySource the source specifying the defining compilation unit of this library
8788 */ 8790 */
8789 Library(InternalAnalysisContext analysisContext, AnalysisErrorListener errorLi stener, this.librarySource) { 8791 Library(InternalAnalysisContext analysisContext, AnalysisErrorListener errorLi stener, Source librarySource) {
8790 this._analysisContext = analysisContext; 8792 this._analysisContext = analysisContext;
8791 this._errorListener = errorListener; 8793 this._errorListener = errorListener;
8794 this.librarySource = librarySource;
8792 this._libraryElement = analysisContext.getLibraryElement(librarySource) as L ibraryElementImpl; 8795 this._libraryElement = analysisContext.getLibraryElement(librarySource) as L ibraryElementImpl;
8793 } 8796 }
8794 8797
8795 /** 8798 /**
8796 * Return the AST structure associated with the given source. 8799 * Return the AST structure associated with the given source.
8797 * 8800 *
8798 * @param source the source representing the compilation unit whose AST is to be returned 8801 * @param source the source representing the compilation unit whose AST is to be returned
8799 * @return the AST structure associated with the given source 8802 * @return the AST structure associated with the given source
8800 * @throws AnalysisException if an AST structure could not be created for the compilation unit 8803 * @throws AnalysisException if an AST structure could not be created for the compilation unit
8801 */ 8804 */
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
8971 8974
8972 /** 8975 /**
8973 * Set the AST structure associated with the defining compilation unit for thi s library to the 8976 * Set the AST structure associated with the defining compilation unit for thi s library to the
8974 * given AST structure. 8977 * given AST structure.
8975 * 8978 *
8976 * @param modificationStamp the modification time of the source from which the compilation unit 8979 * @param modificationStamp the modification time of the source from which the compilation unit
8977 * was created 8980 * was created
8978 * @param unit the AST structure associated with the defining compilation unit for this library 8981 * @param unit the AST structure associated with the defining compilation unit for this library
8979 */ 8982 */
8980 void setDefiningCompilationUnit(int modificationStamp, CompilationUnit unit) { 8983 void setDefiningCompilationUnit(int modificationStamp, CompilationUnit unit) {
8981 _astMap[librarySource] = new ResolvableCompilationUnit(modificationStamp, un it); 8984 _astMap[librarySource] = new ResolvableCompilationUnit.con1(modificationStam p, unit);
8982 } 8985 }
8983 8986
8984 /** 8987 /**
8985 * Set the libraries that are exported by this library to be those in the give n array. 8988 * Set the libraries that are exported by this library to be those in the give n array.
8986 * 8989 *
8987 * @param exportedLibraries the libraries that are exported by this library 8990 * @param exportedLibraries the libraries that are exported by this library
8988 */ 8991 */
8989 void set exportedLibraries(List<Library> exportedLibraries) { 8992 void set exportedLibraries(List<Library> exportedLibraries) {
8990 this._exportedLibraries = exportedLibraries; 8993 this._exportedLibraries = exportedLibraries;
8991 } 8994 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
9216 } 9219 }
9217 9220
9218 /** 9221 /**
9219 * Instances of the class `LibraryResolver` are used to resolve one or more mutu ally dependent 9222 * Instances of the class `LibraryResolver` are used to resolve one or more mutu ally dependent
9220 * libraries within a single context. 9223 * libraries within a single context.
9221 */ 9224 */
9222 class LibraryResolver { 9225 class LibraryResolver {
9223 /** 9226 /**
9224 * The analysis context in which the libraries are being analyzed. 9227 * The analysis context in which the libraries are being analyzed.
9225 */ 9228 */
9226 final InternalAnalysisContext analysisContext; 9229 InternalAnalysisContext analysisContext;
9227 9230
9228 /** 9231 /**
9229 * The listener to which analysis errors will be reported, this error listener is either 9232 * The listener to which analysis errors will be reported, this error listener is either
9230 * references [recordingErrorListener], or it unions the passed 9233 * references [recordingErrorListener], or it unions the passed
9231 * [AnalysisErrorListener] with the [recordingErrorListener]. 9234 * [AnalysisErrorListener] with the [recordingErrorListener].
9232 */ 9235 */
9233 RecordingErrorListener _errorListener; 9236 RecordingErrorListener _errorListener;
9234 9237
9235 /** 9238 /**
9236 * A source object representing the core library (dart:core). 9239 * A source object representing the core library (dart:core).
(...skipping 18 matching lines...) Expand all
9255 /** 9258 /**
9256 * A collection containing the libraries that are being resolved together. 9259 * A collection containing the libraries that are being resolved together.
9257 */ 9260 */
9258 Set<Library> _librariesInCycles; 9261 Set<Library> _librariesInCycles;
9259 9262
9260 /** 9263 /**
9261 * Initialize a newly created library resolver to resolve libraries within the given context. 9264 * Initialize a newly created library resolver to resolve libraries within the given context.
9262 * 9265 *
9263 * @param analysisContext the analysis context in which the library is being a nalyzed 9266 * @param analysisContext the analysis context in which the library is being a nalyzed
9264 */ 9267 */
9265 LibraryResolver(this.analysisContext) { 9268 LibraryResolver(InternalAnalysisContext analysisContext) {
9269 this.analysisContext = analysisContext;
9266 this._errorListener = new RecordingErrorListener(); 9270 this._errorListener = new RecordingErrorListener();
9267 _coreLibrarySource = analysisContext.sourceFactory.forUri(DartSdk.DART_CORE) ; 9271 _coreLibrarySource = analysisContext.sourceFactory.forUri(DartSdk.DART_CORE) ;
9268 } 9272 }
9269 9273
9270 /** 9274 /**
9271 * Return the listener to which analysis errors will be reported. 9275 * Return the listener to which analysis errors will be reported.
9272 * 9276 *
9273 * @return the listener to which analysis errors will be reported 9277 * @return the listener to which analysis errors will be reported
9274 */ 9278 */
9275 RecordingErrorListener get errorListener => _errorListener; 9279 RecordingErrorListener get errorListener => _errorListener;
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
10119 class ProxyConditionalAnalysisError { 10123 class ProxyConditionalAnalysisError {
10120 /** 10124 /**
10121 * The enclosing [ClassElement], this is what will determine if the error code should, or 10125 * The enclosing [ClassElement], this is what will determine if the error code should, or
10122 * should not, be generated on the source. 10126 * should not, be generated on the source.
10123 */ 10127 */
10124 Element _enclosingElement; 10128 Element _enclosingElement;
10125 10129
10126 /** 10130 /**
10127 * The conditional analysis error. 10131 * The conditional analysis error.
10128 */ 10132 */
10129 final AnalysisError analysisError; 10133 AnalysisError analysisError;
10130 10134
10131 /** 10135 /**
10132 * Instantiate a new [ProxyConditionalAnalysisError] with some enclosing eleme nt and the 10136 * Instantiate a new [ProxyConditionalAnalysisError] with some enclosing eleme nt and the
10133 * conditional analysis error. 10137 * conditional analysis error.
10134 * 10138 *
10135 * @param enclosingElement the enclosing element 10139 * @param enclosingElement the enclosing element
10136 * @param analysisError the conditional analysis error 10140 * @param analysisError the conditional analysis error
10137 */ 10141 */
10138 ProxyConditionalAnalysisError(Element enclosingElement, this.analysisError) { 10142 ProxyConditionalAnalysisError(Element enclosingElement, AnalysisError analysis Error) {
10139 this._enclosingElement = enclosingElement; 10143 this._enclosingElement = enclosingElement;
10144 this.analysisError = analysisError;
10140 } 10145 }
10141 10146
10142 /** 10147 /**
10143 * Return `true` iff the enclosing class has the proxy annotation. 10148 * Return `true` iff the enclosing class has the proxy annotation.
10144 * 10149 *
10145 * @return `true` iff the enclosing class has the proxy annotation 10150 * @return `true` iff the enclosing class has the proxy annotation
10146 */ 10151 */
10147 bool shouldIncludeErrorCode() { 10152 bool shouldIncludeErrorCode() {
10148 if (_enclosingElement is ClassElement) { 10153 if (_enclosingElement is ClassElement) {
10149 return !(_enclosingElement as ClassElement).isOrInheritsProxy; 10154 return !(_enclosingElement as ClassElement).isOrInheritsProxy;
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
11464 */ 11469 */
11465 abstract class ScopedVisitor extends UnifyingAstVisitor<Object> { 11470 abstract class ScopedVisitor extends UnifyingAstVisitor<Object> {
11466 /** 11471 /**
11467 * The element for the library containing the compilation unit being visited. 11472 * The element for the library containing the compilation unit being visited.
11468 */ 11473 */
11469 LibraryElement _definingLibrary; 11474 LibraryElement _definingLibrary;
11470 11475
11471 /** 11476 /**
11472 * The source representing the compilation unit being visited. 11477 * The source representing the compilation unit being visited.
11473 */ 11478 */
11474 final Source source; 11479 Source source;
11475 11480
11476 /** 11481 /**
11477 * The error listener that will be informed of any errors that are found durin g resolution. 11482 * The error listener that will be informed of any errors that are found durin g resolution.
11478 */ 11483 */
11479 AnalysisErrorListener _errorListener; 11484 AnalysisErrorListener _errorListener;
11480 11485
11481 /** 11486 /**
11482 * The scope used to resolve identifiers. 11487 * The scope used to resolve identifiers.
11483 */ 11488 */
11484 Scope _nameScope; 11489 Scope _nameScope;
11485 11490
11486 /** 11491 /**
11487 * The object used to access the types from the core library. 11492 * The object used to access the types from the core library.
11488 */ 11493 */
11489 final TypeProvider typeProvider; 11494 TypeProvider typeProvider;
11490 11495
11491 /** 11496 /**
11492 * The scope used to resolve labels for `break` and `continue` statements, or 11497 * The scope used to resolve labels for `break` and `continue` statements, or
11493 * `null` if no labels have been defined in the current context. 11498 * `null` if no labels have been defined in the current context.
11494 */ 11499 */
11495 LabelScope _labelScope; 11500 LabelScope _labelScope;
11496 11501
11497 /** 11502 /**
11498 * Initialize a newly created visitor to resolve the nodes in a compilation un it. 11503 * Initialize a newly created visitor to resolve the nodes in a compilation un it.
11499 * 11504 *
11500 * @param library the library containing the compilation unit being resolved 11505 * @param library the library containing the compilation unit being resolved
11501 * @param source the source representing the compilation unit being visited 11506 * @param source the source representing the compilation unit being visited
11502 * @param typeProvider the object used to access the types from the core libra ry 11507 * @param typeProvider the object used to access the types from the core libra ry
11503 */ 11508 */
11504 ScopedVisitor.con1(Library library, this.source, this.typeProvider) { 11509 ScopedVisitor.con1(Library library, Source source, TypeProvider typeProvider) {
11505 this._definingLibrary = library.libraryElement; 11510 this._definingLibrary = library.libraryElement;
11511 this.source = source;
11506 LibraryScope libraryScope = library.libraryScope; 11512 LibraryScope libraryScope = library.libraryScope;
11507 this._errorListener = libraryScope.errorListener; 11513 this._errorListener = libraryScope.errorListener;
11508 this._nameScope = libraryScope; 11514 this._nameScope = libraryScope;
11515 this.typeProvider = typeProvider;
11509 } 11516 }
11510 11517
11511 /** 11518 /**
11512 * Initialize a newly created visitor to resolve the nodes in a compilation un it. 11519 * Initialize a newly created visitor to resolve the nodes in a compilation un it.
11513 * 11520 *
11514 * @param definingLibrary the element for the library containing the compilati on unit being 11521 * @param definingLibrary the element for the library containing the compilati on unit being
11515 * visited 11522 * visited
11516 * @param source the source representing the compilation unit being visited 11523 * @param source the source representing the compilation unit being visited
11517 * @param typeProvider the object used to access the types from the core libra ry 11524 * @param typeProvider the object used to access the types from the core libra ry
11518 * @param errorListener the error listener that will be informed of any errors that are found 11525 * @param errorListener the error listener that will be informed of any errors that are found
11519 * during resolution 11526 * during resolution
11520 */ 11527 */
11521 ScopedVisitor.con2(LibraryElement definingLibrary, this.source, this.typeProvi der, AnalysisErrorListener errorListener) { 11528 ScopedVisitor.con2(LibraryElement definingLibrary, Source source, TypeProvider typeProvider, AnalysisErrorListener errorListener) {
11522 this._definingLibrary = definingLibrary; 11529 this._definingLibrary = definingLibrary;
11530 this.source = source;
11523 this._errorListener = errorListener; 11531 this._errorListener = errorListener;
11524 this._nameScope = new LibraryScope(definingLibrary, errorListener); 11532 this._nameScope = new LibraryScope(definingLibrary, errorListener);
11533 this.typeProvider = typeProvider;
11525 } 11534 }
11526 11535
11527 /** 11536 /**
11528 * Initialize a newly created visitor to resolve the nodes in a compilation un it. 11537 * Initialize a newly created visitor to resolve the nodes in a compilation un it.
11529 * 11538 *
11530 * @param definingLibrary the element for the library containing the compilati on unit being 11539 * @param definingLibrary the element for the library containing the compilati on unit being
11531 * visited 11540 * visited
11532 * @param source the source representing the compilation unit being visited 11541 * @param source the source representing the compilation unit being visited
11533 * @param typeProvider the object used to access the types from the core libra ry 11542 * @param typeProvider the object used to access the types from the core libra ry
11534 * @param nameScope the scope used to resolve identifiers in the node that wil l first be visited 11543 * @param nameScope the scope used to resolve identifiers in the node that wil l first be visited
11535 * @param errorListener the error listener that will be informed of any errors that are found 11544 * @param errorListener the error listener that will be informed of any errors that are found
11536 * during resolution 11545 * during resolution
11537 */ 11546 */
11538 ScopedVisitor.con3(LibraryElement definingLibrary, this.source, this.typeProvi der, Scope nameScope, AnalysisErrorListener errorListener) { 11547 ScopedVisitor.con3(LibraryElement definingLibrary, Source source, TypeProvider typeProvider, Scope nameScope, AnalysisErrorListener errorListener) {
11539 this._definingLibrary = definingLibrary; 11548 this._definingLibrary = definingLibrary;
11549 this.source = source;
11540 this._errorListener = errorListener; 11550 this._errorListener = errorListener;
11541 this._nameScope = nameScope; 11551 this._nameScope = nameScope;
11552 this.typeProvider = typeProvider;
11542 } 11553 }
11543 11554
11544 /** 11555 /**
11545 * Return the library element for the library containing the compilation unit being resolved. 11556 * Return the library element for the library containing the compilation unit being resolved.
11546 * 11557 *
11547 * @return the library element for the library containing the compilation unit being resolved 11558 * @return the library element for the library containing the compilation unit being resolved
11548 */ 11559 */
11549 LibraryElement get definingLibrary => _definingLibrary; 11560 LibraryElement get definingLibrary => _definingLibrary;
11550 11561
11551 /** 11562 /**
(...skipping 4224 matching lines...) Expand 10 before | Expand all | Expand 10 after
15776 } 15787 }
15777 15788
15778 /** 15789 /**
15779 * Instances of the class `EnclosedScope` implement a scope that is lexically en closed in 15790 * Instances of the class `EnclosedScope` implement a scope that is lexically en closed in
15780 * another scope. 15791 * another scope.
15781 */ 15792 */
15782 class EnclosedScope extends Scope { 15793 class EnclosedScope extends Scope {
15783 /** 15794 /**
15784 * The scope in which this scope is lexically enclosed. 15795 * The scope in which this scope is lexically enclosed.
15785 */ 15796 */
15786 final Scope enclosingScope; 15797 Scope enclosingScope;
15787 15798
15788 /** 15799 /**
15789 * A table mapping names that will be defined in this scope, but right now are not initialized. 15800 * A table mapping names that will be defined in this scope, but right now are not initialized.
15790 * According to the scoping rules these names are hidden, even if they were de fined in an outer 15801 * According to the scoping rules these names are hidden, even if they were de fined in an outer
15791 * scope. 15802 * scope.
15792 */ 15803 */
15793 Map<String, Element> _hiddenElements = new Map<String, Element>(); 15804 Map<String, Element> _hiddenElements = new Map<String, Element>();
15794 15805
15795 /** 15806 /**
15796 * A flag indicating whether there are any names defined in this scope. 15807 * A flag indicating whether there are any names defined in this scope.
15797 */ 15808 */
15798 bool _hasHiddenName = false; 15809 bool _hasHiddenName = false;
15799 15810
15800 /** 15811 /**
15801 * Initialize a newly created scope enclosed within another scope. 15812 * Initialize a newly created scope enclosed within another scope.
15802 * 15813 *
15803 * @param enclosingScope the scope in which this scope is lexically enclosed 15814 * @param enclosingScope the scope in which this scope is lexically enclosed
15804 */ 15815 */
15805 EnclosedScope(this.enclosingScope); 15816 EnclosedScope(Scope enclosingScope) {
15817 this.enclosingScope = enclosingScope;
15818 }
15806 15819
15807 @override 15820 @override
15808 AnalysisErrorListener get errorListener => enclosingScope.errorListener; 15821 AnalysisErrorListener get errorListener => enclosingScope.errorListener;
15809 15822
15810 /** 15823 /**
15811 * Record that given element is declared in this scope, but hasn't been initia lized yet, so it is 15824 * Record that given element is declared in this scope, but hasn't been initia lized yet, so it is
15812 * error to use. If there is already an element with the given name defined in an outer scope, 15825 * error to use. If there is already an element with the given name defined in an outer scope,
15813 * then it will become unavailable. 15826 * then it will become unavailable.
15814 * 15827 *
15815 * @param element the element declared, but not initialized in this scope 15828 * @param element the element declared, but not initialized in this scope
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
16010 */ 16023 */
16011 class LibraryImportScope extends Scope { 16024 class LibraryImportScope extends Scope {
16012 /** 16025 /**
16013 * The element representing the library in which this scope is enclosed. 16026 * The element representing the library in which this scope is enclosed.
16014 */ 16027 */
16015 LibraryElement _definingLibrary; 16028 LibraryElement _definingLibrary;
16016 16029
16017 /** 16030 /**
16018 * The listener that is to be informed when an error is encountered. 16031 * The listener that is to be informed when an error is encountered.
16019 */ 16032 */
16020 final AnalysisErrorListener errorListener; 16033 AnalysisErrorListener errorListener;
16021 16034
16022 /** 16035 /**
16023 * A list of the namespaces representing the names that are available in this scope from imported 16036 * A list of the namespaces representing the names that are available in this scope from imported
16024 * libraries. 16037 * libraries.
16025 */ 16038 */
16026 List<Namespace> _importedNamespaces; 16039 List<Namespace> _importedNamespaces;
16027 16040
16028 /** 16041 /**
16029 * Initialize a newly created scope representing the names imported into the g iven library. 16042 * Initialize a newly created scope representing the names imported into the g iven library.
16030 * 16043 *
16031 * @param definingLibrary the element representing the library that imports th e names defined in 16044 * @param definingLibrary the element representing the library that imports th e names defined in
16032 * this scope 16045 * this scope
16033 * @param errorListener the listener that is to be informed when an error is e ncountered 16046 * @param errorListener the listener that is to be informed when an error is e ncountered
16034 */ 16047 */
16035 LibraryImportScope(LibraryElement definingLibrary, this.errorListener) { 16048 LibraryImportScope(LibraryElement definingLibrary, AnalysisErrorListener error Listener) {
16036 this._definingLibrary = definingLibrary; 16049 this._definingLibrary = definingLibrary;
16050 this.errorListener = errorListener;
16037 _createImportedNamespaces(definingLibrary); 16051 _createImportedNamespaces(definingLibrary);
16038 } 16052 }
16039 16053
16040 @override 16054 @override
16041 void define(Element element) { 16055 void define(Element element) {
16042 if (!Scope.isPrivateName(element.displayName)) { 16056 if (!Scope.isPrivateName(element.displayName)) {
16043 super.define(element); 16057 super.define(element);
16044 } 16058 }
16045 } 16059 }
16046 16060
(...skipping 4658 matching lines...) Expand 10 before | Expand all | Expand 10 after
20705 for (int i = 0; i < membersInheritedFromInterfaces.size; i++) { 20719 for (int i = 0; i < membersInheritedFromInterfaces.size; i++) {
20706 String memberName = membersInheritedFromInterfaces.getKey(i); 20720 String memberName = membersInheritedFromInterfaces.getKey(i);
20707 ExecutableElement executableElt = membersInheritedFromInterfaces.getValue( i); 20721 ExecutableElement executableElt = membersInheritedFromInterfaces.getValue( i);
20708 if (memberName == null) { 20722 if (memberName == null) {
20709 break; 20723 break;
20710 } 20724 }
20711 // If the element is not synthetic and can be determined to be defined in Object, skip it. 20725 // If the element is not synthetic and can be determined to be defined in Object, skip it.
20712 if (executableElt.enclosingElement != null && (executableElt.enclosingElem ent as ClassElement).type.isObject) { 20726 if (executableElt.enclosingElement != null && (executableElt.enclosingElem ent as ClassElement).type.isObject) {
20713 continue; 20727 continue;
20714 } 20728 }
20715 // Reference the type of the enclosing class
20716 InterfaceType enclosingType = _enclosingClass.type;
20717 // Check to see if some element is in local enclosing class that matches t he name of the 20729 // Check to see if some element is in local enclosing class that matches t he name of the
20718 // required member. 20730 // required member.
20719 if (_isMemberInClassOrMixin(executableElt, _enclosingClass)) { 20731 if (_isMemberInClassOrMixin(executableElt, _enclosingClass)) {
20720 // We do not have to verify that this implementation of the found method matches the 20732 // We do not have to verify that this implementation of the found method matches the
20721 // required function type: the set of StaticWarningCode.INVALID_METHOD_O VERRIDE_* warnings 20733 // required function type: the set of StaticWarningCode.INVALID_METHOD_O VERRIDE_* warnings
20722 // break out the different specific situations. 20734 // break out the different specific situations.
20723 continue; 20735 continue;
20724 } 20736 }
20725 // First check to see if this element was declared in the superclass chain , in which case 20737 // First check to see if this element was declared in the superclass chain , in which case
20726 // there is already a concrete implementation. 20738 // there is already a concrete implementation.
20727 ExecutableElement elt = membersInheritedFromSuperclasses.get(executableElt .name); 20739 ExecutableElement elt = membersInheritedFromSuperclasses.get(memberName);
20728 // Check to see if an element was found in the superclass chain with the c orrect name. 20740 // Check to see if an element was found in the superclass chain with the c orrect name.
20729 if (elt != null) { 20741 if (elt != null) {
20742 // Reference the types, if any are null then continue.
20743 InterfaceType enclosingType = _enclosingClass.type;
20744 FunctionType concreteType = elt.type;
20745 FunctionType requiredMemberType = executableElt.type;
20746 if (enclosingType == null || concreteType == null || requiredMemberType == null) {
20747 continue;
20748 }
20730 // Some element was found in the superclass chain that matches the name of the required 20749 // Some element was found in the superclass chain that matches the name of the required
20731 // member. 20750 // member.
20732 // If it is not abstract and it is the correct one (types match- the ver sion of this method 20751 // If it is not abstract and it is the correct one (types match- the ver sion of this method
20733 // that we have has the correct number of parameters, etc), then this cl ass has a valid 20752 // that we have has the correct number of parameters, etc), then this cl ass has a valid
20734 // implementation of this method, so skip it. 20753 // implementation of this method, so skip it.
20735 if ((elt is MethodElement && !elt.isAbstract) || (elt is PropertyAccesso rElement && !elt.isAbstract)) { 20754 if ((elt is MethodElement && !elt.isAbstract) || (elt is PropertyAccesso rElement && !elt.isAbstract)) {
20736 // Since we are comparing two function types, we need to do the approp riate type 20755 // Since we are comparing two function types, we need to do the approp riate type
20737 // substitutions first (). 20756 // substitutions first ().
20738 FunctionType foundConcreteFT = _inheritanceManager.substituteTypeArgum entsInMemberFromInheritance(elt.type, executableElt.name, enclosingType); 20757 FunctionType foundConcreteFT = _inheritanceManager.substituteTypeArgum entsInMemberFromInheritance(concreteType, memberName, enclosingType);
20739 FunctionType requiredMemberFT = _inheritanceManager.substituteTypeArgu mentsInMemberFromInheritance(executableElt.type, executableElt.name, enclosingTy pe); 20758 FunctionType requiredMemberFT = _inheritanceManager.substituteTypeArgu mentsInMemberFromInheritance(requiredMemberType, memberName, enclosingType);
20740 if (foundConcreteFT.isSubtypeOf(requiredMemberFT)) { 20759 if (foundConcreteFT.isSubtypeOf(requiredMemberFT)) {
20741 continue; 20760 continue;
20742 } 20761 }
20743 } 20762 }
20744 } 20763 }
20745 // The not qualifying concrete executable element was found, add it to the list. 20764 // The not qualifying concrete executable element was found, add it to the list.
20746 missingOverrides.add(executableElt); 20765 missingOverrides.add(executableElt);
20747 } 20766 }
20748 // Now that we have the set of missing overrides, generate a warning on this class 20767 // Now that we have the set of missing overrides, generate a warning on this class
20749 int missingOverridesSize = missingOverrides.length; 20768 int missingOverridesSize = missingOverrides.length;
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after
22093 static final ResolverErrorCode MISSING_LIBRARY_DIRECTIVE_WITH_PART = new Resol verErrorCode.con1('MISSING_LIBRARY_DIRECTIVE_WITH_PART', 2, ErrorType.COMPILE_TI ME_ERROR, "Libraries that have parts must have a library directive"); 22112 static final ResolverErrorCode MISSING_LIBRARY_DIRECTIVE_WITH_PART = new Resol verErrorCode.con1('MISSING_LIBRARY_DIRECTIVE_WITH_PART', 2, ErrorType.COMPILE_TI ME_ERROR, "Libraries that have parts must have a library directive");
22094 22113
22095 static final List<ResolverErrorCode> values = [ 22114 static final List<ResolverErrorCode> values = [
22096 BREAK_LABEL_ON_SWITCH_MEMBER, 22115 BREAK_LABEL_ON_SWITCH_MEMBER,
22097 CONTINUE_LABEL_ON_SWITCH, 22116 CONTINUE_LABEL_ON_SWITCH,
22098 MISSING_LIBRARY_DIRECTIVE_WITH_PART]; 22117 MISSING_LIBRARY_DIRECTIVE_WITH_PART];
22099 22118
22100 /** 22119 /**
22101 * The type of this error. 22120 * The type of this error.
22102 */ 22121 */
22103 final ErrorType type; 22122 ErrorType type;
22104 22123
22105 /** 22124 /**
22106 * The template used to create the message to be displayed for this error. 22125 * The template used to create the message to be displayed for this error.
22107 */ 22126 */
22108 final String message; 22127 String message;
22109 22128
22110 /** 22129 /**
22111 * The template used to create the correction to be displayed for this error, or `null` if 22130 * The template used to create the correction to be displayed for this error, or `null` if
22112 * there is no correction information for this error. 22131 * there is no correction information for this error.
22113 */ 22132 */
22114 String correction9; 22133 String correction9;
22115 22134
22116 /** 22135 /**
22117 * Initialize a newly created error code to have the given type and message. 22136 * Initialize a newly created error code to have the given type and message.
22118 * 22137 *
22119 * @param type the type of this error 22138 * @param type the type of this error
22120 * @param message the message template used to create the message to be displa yed for the error 22139 * @param message the message template used to create the message to be displa yed for the error
22121 */ 22140 */
22122 ResolverErrorCode.con1(String name, int ordinal, this.type, this.message) : su per(name, ordinal); 22141 ResolverErrorCode.con1(String name, int ordinal, ErrorType type, String messag e) : super(name, ordinal) {
22142 this.type = type;
22143 this.message = message;
22144 }
22123 22145
22124 /** 22146 /**
22125 * Initialize a newly created error code to have the given type, message and c orrection. 22147 * Initialize a newly created error code to have the given type, message and c orrection.
22126 * 22148 *
22127 * @param type the type of this error 22149 * @param type the type of this error
22128 * @param message the template used to create the message to be displayed for the error 22150 * @param message the template used to create the message to be displayed for the error
22129 * @param correction the template used to create the correction to be displaye d for the error 22151 * @param correction the template used to create the correction to be displaye d for the error
22130 */ 22152 */
22131 ResolverErrorCode.con2(String name, int ordinal, this.type, this.message, Stri ng correction) : super(name, ordinal) { 22153 ResolverErrorCode.con2(String name, int ordinal, ErrorType type, String messag e, String correction) : super(name, ordinal) {
22154 this.type = type;
22155 this.message = message;
22132 this.correction9 = correction; 22156 this.correction9 = correction;
22133 } 22157 }
22134 22158
22135 @override 22159 @override
22136 String get correction => correction9; 22160 String get correction => correction9;
22137 22161
22138 @override 22162 @override
22139 ErrorSeverity get errorSeverity => type.severity; 22163 ErrorSeverity get errorSeverity => type.severity;
22140 } 22164 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698