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

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

Issue 1325513004: Resolve enum documentation comments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
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 db292e7472517690fe740eeba1955f6ac561ebc8..f998450a13fbb457d104b1a88dec2004672e4755 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -10757,9 +10757,21 @@ class ResolverVisitor extends ScopedVisitor {
ElementResolver.setMetadata(node.element, node);
}
//
- // There is nothing else to do because everything else was resolved by the
- // element builder.
+ // Continue the enum resolution.
//
+ ClassElement outerType = enclosingClass;
+ try {
+ enclosingClass = node.element;
+ typeAnalyzer.thisType =
+ enclosingClass == null ? null : enclosingClass.type;
+ super.visitEnumDeclaration(node);
+ node.accept(elementResolver);
+ node.accept(typeAnalyzer);
+ } finally {
+ typeAnalyzer.thisType = outerType == null ? null : outerType.type;
+ enclosingClass = outerType;
+ _enclosingClassDeclaration = null;
+ }
return null;
}
@@ -12096,6 +12108,38 @@ abstract class ScopedVisitor extends UnifyingAstVisitor<Object> {
}
@override
+ Object visitEnumDeclaration(EnumDeclaration node) {
+ ClassElement classElement = node.element;
+ Scope outerScope = nameScope;
+ try {
+ if (classElement == null) {
+ AnalysisEngine.instance.logger.logInformation(
+ "Missing element for enum declaration ${node.name.name} in ${definingLibrary.source.fullName}",
+ new CaughtException(new AnalysisException(), null));
+ super.visitEnumDeclaration(node);
+ } else {
+ ClassElement outerClass = enclosingClass;
+ try {
+ enclosingClass = node.element;
+ nameScope = new ClassScope(nameScope, classElement);
+ visitEnumMembersInScope(node);
+ } finally {
+ enclosingClass = outerClass;
+ }
+ }
+ } finally {
+ nameScope = outerScope;
+ }
+ return null;
+ }
+
+ void visitEnumMembersInScope(EnumDeclaration node) {
+ safelyVisit(node.documentationComment);
+ node.metadata.accept(this);
+ node.constants.accept(this);
+ }
+
+ @override
Object visitForEachStatement(ForEachStatement node) {
Scope outerNameScope = nameScope;
ImplicitLabelScope outerImplicitScope = _implicitLabelScope;
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698