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

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

Issue 751553003: Extend resolution Scope with ResolutionContext and set it for ResolverVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 library engine.resolver; 5 library engine.resolver;
6 6
7 import "dart:math" as math; 7 import "dart:math" as math;
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'ast.dart'; 10 import 'ast.dart';
(...skipping 10998 matching lines...) Expand 10 before | Expand all | Expand 10 after
11009 * The object used to resolve the element associated with the current node. 11009 * The object used to resolve the element associated with the current node.
11010 */ 11010 */
11011 ElementResolver _elementResolver; 11011 ElementResolver _elementResolver;
11012 11012
11013 /** 11013 /**
11014 * The object used to compute the type associated with the current node. 11014 * The object used to compute the type associated with the current node.
11015 */ 11015 */
11016 StaticTypeAnalyzer _typeAnalyzer; 11016 StaticTypeAnalyzer _typeAnalyzer;
11017 11017
11018 /** 11018 /**
11019 * The class element representing the class containing the current node, or `n ull` if the 11019 * The class element representing the class containing the current node,
11020 * current node is not contained in a class. 11020 * or `null` if the current node is not contained in a class.
11021 */ 11021 */
11022 ClassElement _enclosingClass = null; 11022 ClassElement enclosingClass = null;
11023 11023
11024 /** 11024 /**
11025 * The class declaration representing the class containing the current node, o r `null` if 11025 * The class declaration representing the class containing the current node, o r `null` if
11026 * the current node is not contained in a class. 11026 * the current node is not contained in a class.
11027 */ 11027 */
11028 ClassDeclaration _enclosingClassDeclaration = null; 11028 ClassDeclaration _enclosingClassDeclaration = null;
11029 11029
11030 /** 11030 /**
11031 * The function type alias representing the function type containing the curre nt node, or 11031 * The function type alias representing the function type containing the curre nt node, or
11032 * `null` if the current node is not contained in a function type alias. 11032 * `null` if the current node is not contained in a function type alias.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
11125 this._inheritanceManager = library.inheritanceManager; 11125 this._inheritanceManager = library.inheritanceManager;
11126 this._elementResolver = new ElementResolver(this); 11126 this._elementResolver = new ElementResolver(this);
11127 this._typeAnalyzer = new StaticTypeAnalyzer(this); 11127 this._typeAnalyzer = new StaticTypeAnalyzer(this);
11128 } 11128 }
11129 11129
11130 get elementResolver_J2DAccessor => _elementResolver; 11130 get elementResolver_J2DAccessor => _elementResolver;
11131 11131
11132 set elementResolver_J2DAccessor(__v) => _elementResolver = __v; 11132 set elementResolver_J2DAccessor(__v) => _elementResolver = __v;
11133 11133
11134 /** 11134 /**
11135 * Return the class element representing the class containing the current node , or `null` if
11136 * the current node is not contained in a class.
11137 *
11138 * @return the class element representing the class containing the current nod e
11139 */
11140 ClassElement get enclosingClass => _enclosingClass;
11141
11142 get enclosingClass_J2DAccessor => _enclosingClass;
11143
11144 set enclosingClass_J2DAccessor(__v) => _enclosingClass = __v;
11145
11146 /**
11147 * Return the element representing the function containing the current node, o r `null` if 11135 * Return the element representing the function containing the current node, o r `null` if
11148 * the current node is not contained in a function. 11136 * the current node is not contained in a function.
11149 * 11137 *
11150 * @return the element representing the function containing the current node 11138 * @return the element representing the function containing the current node
11151 */ 11139 */
11152 ExecutableElement get enclosingFunction => _enclosingFunction; 11140 ExecutableElement get enclosingFunction => _enclosingFunction;
11153 11141
11154 get labelScope_J2DAccessor => _labelScope; 11142 get labelScope_J2DAccessor => _labelScope;
11155 11143
11156 set labelScope_J2DAccessor(__v) => _labelScope = __v; 11144 set labelScope_J2DAccessor(__v) => _labelScope = __v;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
11426 // 11414 //
11427 // Resolve the metadata in the library scope. 11415 // Resolve the metadata in the library scope.
11428 // 11416 //
11429 if (node.metadata != null) { 11417 if (node.metadata != null) {
11430 node.metadata.accept(this); 11418 node.metadata.accept(this);
11431 } 11419 }
11432 _enclosingClassDeclaration = node; 11420 _enclosingClassDeclaration = node;
11433 // 11421 //
11434 // Continue the class resolution. 11422 // Continue the class resolution.
11435 // 11423 //
11436 ClassElement outerType = _enclosingClass; 11424 ClassElement outerType = enclosingClass;
11437 try { 11425 try {
11438 _enclosingClass = node.element; 11426 enclosingClass = node.element;
11439 _typeAnalyzer.thisType = 11427 _typeAnalyzer.thisType =
11440 _enclosingClass == null ? null : _enclosingClass.type; 11428 enclosingClass == null ? null : enclosingClass.type;
11441 super.visitClassDeclaration(node); 11429 super.visitClassDeclaration(node);
11442 node.accept(_elementResolver); 11430 node.accept(_elementResolver);
11443 node.accept(_typeAnalyzer); 11431 node.accept(_typeAnalyzer);
11444 } finally { 11432 } finally {
11445 _typeAnalyzer.thisType = outerType == null ? null : outerType.type; 11433 _typeAnalyzer.thisType = outerType == null ? null : outerType.type;
11446 _enclosingClass = outerType; 11434 enclosingClass = outerType;
11447 _enclosingClassDeclaration = null; 11435 _enclosingClassDeclaration = null;
11448 } 11436 }
11449 return null; 11437 return null;
11450 } 11438 }
11451 11439
11452 @override 11440 @override
11453 Object visitComment(Comment node) { 11441 Object visitComment(Comment node) {
11454 if (node.parent is FunctionDeclaration || 11442 if (node.parent is FunctionDeclaration ||
11455 node.parent is ConstructorDeclaration || 11443 node.parent is ConstructorDeclaration ||
11456 node.parent is MethodDeclaration) { 11444 node.parent is MethodDeclaration) {
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
12630 /** 12618 /**
12631 * The scope used to resolve labels for `break` and `continue` statements, or 12619 * The scope used to resolve labels for `break` and `continue` statements, or
12632 * `null` if no labels have been defined in the current context. 12620 * `null` if no labels have been defined in the current context.
12633 */ 12621 */
12634 LabelScope _labelScope; 12622 LabelScope _labelScope;
12635 12623
12636 /** 12624 /**
12637 * The class containing the AST nodes being visited, 12625 * The class containing the AST nodes being visited,
12638 * or `null` if we are not in the scope of a class. 12626 * or `null` if we are not in the scope of a class.
12639 */ 12627 */
12640 ClassElement _enclosingClass; 12628 ClassElement enclosingClass;
12641 12629
12642 /** 12630 /**
12643 * Initialize a newly created visitor to resolve the nodes in a compilation un it. 12631 * Initialize a newly created visitor to resolve the nodes in a compilation un it.
12644 * 12632 *
12645 * @param library the library containing the compilation unit being resolved 12633 * @param library the library containing the compilation unit being resolved
12646 * @param source the source representing the compilation unit being visited 12634 * @param source the source representing the compilation unit being visited
12647 * @param typeProvider the object used to access the types from the core libra ry 12635 * @param typeProvider the object used to access the types from the core libra ry
12648 */ 12636 */
12649 ScopedVisitor.con1(Library library, this.source, this.typeProvider) { 12637 ScopedVisitor.con1(Library library, this.source, this.typeProvider) {
12650 this._definingLibrary = library.libraryElement; 12638 this._definingLibrary = library.libraryElement;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
12841 Object visitClassDeclaration(ClassDeclaration node) { 12829 Object visitClassDeclaration(ClassDeclaration node) {
12842 ClassElement classElement = node.element; 12830 ClassElement classElement = node.element;
12843 Scope outerScope = _nameScope; 12831 Scope outerScope = _nameScope;
12844 try { 12832 try {
12845 if (classElement == null) { 12833 if (classElement == null) {
12846 AnalysisEngine.instance.logger.logInformation( 12834 AnalysisEngine.instance.logger.logInformation(
12847 "Missing element for class declaration ${node.name.name} in ${defini ngLibrary.source.fullName}", 12835 "Missing element for class declaration ${node.name.name} in ${defini ngLibrary.source.fullName}",
12848 new CaughtException(new AnalysisException(), null)); 12836 new CaughtException(new AnalysisException(), null));
12849 super.visitClassDeclaration(node); 12837 super.visitClassDeclaration(node);
12850 } else { 12838 } else {
12851 ClassElement outerClass = _enclosingClass; 12839 ClassElement outerClass = enclosingClass;
12852 try { 12840 try {
12853 _enclosingClass = node.element; 12841 enclosingClass = node.element;
12854 _nameScope = new TypeParameterScope(_nameScope, classElement); 12842 _nameScope = new TypeParameterScope(_nameScope, classElement);
12855 visitClassDeclarationInScope(node); 12843 visitClassDeclarationInScope(node);
12856 _nameScope = new ClassScope(_nameScope, classElement); 12844 _nameScope = new ClassScope(_nameScope, classElement);
12857 visitClassMembersInScope(node); 12845 visitClassMembersInScope(node);
12858 } finally { 12846 } finally {
12859 _enclosingClass = outerClass; 12847 enclosingClass = outerClass;
12860 } 12848 }
12861 } 12849 }
12862 } finally { 12850 } finally {
12863 _nameScope = outerScope; 12851 _nameScope = outerScope;
12864 } 12852 }
12865 return null; 12853 return null;
12866 } 12854 }
12867 12855
12868 void visitClassDeclarationInScope(ClassDeclaration node) { 12856 void visitClassDeclarationInScope(ClassDeclaration node) {
12869 safelyVisit(node.name); 12857 safelyVisit(node.name);
(...skipping 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after
16222 * library. 16210 * library.
16223 */ 16211 */
16224 final HashSet<String> members = new HashSet<String>(); 16212 final HashSet<String> members = new HashSet<String>();
16225 16213
16226 /** 16214 /**
16227 * Names of resolved or unresolved class members that are read in the 16215 * Names of resolved or unresolved class members that are read in the
16228 * library. 16216 * library.
16229 */ 16217 */
16230 final HashSet<String> readMembers = new HashSet<String>(); 16218 final HashSet<String> readMembers = new HashSet<String>();
16231 } 16219 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | pkg/analyzer/test/generated/incremental_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698