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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 924943010: Minor changes in analyzer to make it easier to extend (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index a0b7d00f7200ae53bb608457a7f6305c58cbb47e..f8b0c257cde111faf8a29b4192649954eaa9917b 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -8309,8 +8309,11 @@ class LibraryResolver {
try {
for (Library library in _librariesInCycles) {
for (Source source in library.compilationUnitSources) {
- TypeResolverVisitor visitor =
- new TypeResolverVisitor.con1(library, source, _typeProvider);
+ var typeResolverVisitorFactory =
Brian Wilkerson 2015/02/20 21:39:07 We provide type annotations everywhere, so please
Siggi Cherem (dart-lang) 2015/02/20 22:12:59 Done.
+ analysisContext.typeResolverVisitorFactory;
+ TypeResolverVisitor visitor = (typeResolverVisitorFactory == null)
+ ? new TypeResolverVisitor.con1(library, source, _typeProvider)
+ : typeResolverVisitorFactory(library, source, _typeProvider);
library.getAST(source).accept(visitor);
}
}
@@ -8592,8 +8595,10 @@ class LibraryResolver {
CompilationUnit ast = library.getAST(source);
ast.accept(
new VariableResolverVisitor.con1(library, source, _typeProvider));
- ResolverVisitor visitor =
- new ResolverVisitor.con1(library, source, _typeProvider);
+ var visitorFactory = analysisContext.resolverVisitorFactory;
+ ResolverVisitor visitor = visitorFactory != null
+ ? visitorFactory(library, source, _typeProvider)
+ : new ResolverVisitor.con1(library, source, _typeProvider);
ast.accept(visitor);
}
} finally {
@@ -10372,6 +10377,12 @@ class ResolverErrorCode extends ErrorCode {
ErrorType get type => ErrorType.COMPILE_TIME_ERROR;
}
+typedef ResolverVisitor ResolverVisitorFactory(
+ Library library, Source source, TypeProvider typeProvider);
+
+typedef TypeResolverVisitor TypeResolverVisitorFactory(
+ Library library, Source source, TypeProvider typeProvider);
+
/**
* Instances of the class `ResolverVisitor` are used to resolve the nodes within a single
* compilation unit.
@@ -10450,13 +10461,19 @@ class ResolverVisitor extends ScopedVisitor {
* @param typeProvider the object used to access the types from the core library
*/
ResolverVisitor.con1(Library library, Source source,
- TypeProvider typeProvider)
+ TypeProvider typeProvider,
+ {StaticTypeAnalyzer typeAnalyzer, typeAnalyzerFactory})
Brian Wilkerson 2015/02/20 21:39:07 ... and annotate all parameters.
Siggi Cherem (dart-lang) 2015/02/20 22:12:59 Done.
: super.con1(library, source, typeProvider) {
this._inheritanceManager = library.inheritanceManager;
this._elementResolver = new ElementResolver(this);
- this._typeAnalyzer = new StaticTypeAnalyzer(this);
+ this._typeAnalyzer = typeAnalyzer != null
+ ? typeAnalyzer
+ : (typeAnalyzerFactory != null
+ ? typeAnalyzerFactory(this)
+ : new StaticTypeAnalyzer(this));
}
+
/**
* Initialize a newly created visitor to resolve the nodes in a compilation unit.
*
@@ -13958,11 +13975,20 @@ class TypeResolverVisitor extends ScopedVisitor {
@override
Object visitClassDeclaration(ClassDeclaration node) {
+ _hasReferenceToSuper = false;
+ super.visitClassDeclaration(node);
+ ClassElement classElement = _getClassElement(node.name);
+ if (classElement != null) {
+ classElement.hasReferenceToSuper = _hasReferenceToSuper;
+ }
+ }
+
+ @override
+ void visitClassDeclarationInScope(ClassDeclaration node) {
+ super.visitClassDeclarationInScope(node);
ExtendsClause extendsClause = node.extendsClause;
WithClause withClause = node.withClause;
ImplementsClause implementsClause = node.implementsClause;
- _hasReferenceToSuper = false;
- super.visitClassDeclaration(node);
ClassElementImpl classElement = _getClassElement(node.name);
InterfaceType superclassType = null;
if (extendsClause != null) {
@@ -13986,7 +14012,6 @@ class TypeResolverVisitor extends ScopedVisitor {
}
}
classElement.supertype = superclassType;
- classElement.hasReferenceToSuper = _hasReferenceToSuper;
}
_resolve(classElement, withClause, implementsClause);
return null;
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698