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

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1531613002: Fix for recording static elements of a prefixed comment reference. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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/error_verifier.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index fa4338d94762abdcea34eb0a568bf1fa1ddbd028..ca7923f9346b5e20408e37995fc20c684b08314d 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -1421,6 +1421,47 @@ class ElementResolverTest extends EngineTestCase {
_listener.assertNoErrors();
}
+ void test_visitCommentReference_prefixedIdentifier_class_getter() {
+ ClassElementImpl classA = ElementFactory.classElement2("A");
+ // set accessors
+ String propName = "p";
+ PropertyAccessorElement getter =
+ ElementFactory.getterElement(propName, false, _typeProvider.intType);
+ PropertyAccessorElement setter =
+ ElementFactory.setterElement(propName, false, _typeProvider.intType);
+ classA.accessors = <PropertyAccessorElement>[getter, setter];
+ // set name scope
+ _visitor.nameScope = new EnclosedScope(null)
+ ..defineNameWithoutChecking('A', classA);
+ // prepare "A.p"
+ PrefixedIdentifier prefixed = AstFactory.identifier5('A', 'p');
+ CommentReference commentReference = new CommentReference(null, prefixed);
+ // resolve
+ _resolveNode(commentReference);
+ expect(prefixed.prefix.staticElement, classA);
+ expect(prefixed.identifier.staticElement, getter);
+ _listener.assertNoErrors();
+ }
+
+ void test_visitCommentReference_prefixedIdentifier_class_method() {
+ ClassElementImpl classA = ElementFactory.classElement2("A");
+ // set method
+ MethodElement method =
+ ElementFactory.methodElement("m", _typeProvider.intType);
+ classA.methods = <MethodElement>[method];
+ // set name scope
+ _visitor.nameScope = new EnclosedScope(null)
+ ..defineNameWithoutChecking('A', classA);
+ // prepare "A.m"
+ PrefixedIdentifier prefixed = AstFactory.identifier5('A', 'm');
+ CommentReference commentReference = new CommentReference(null, prefixed);
+ // resolve
+ _resolveNode(commentReference);
+ expect(prefixed.prefix.staticElement, classA);
+ expect(prefixed.identifier.staticElement, method);
+ _listener.assertNoErrors();
+ }
+
void test_visitConstructorName_named() {
ClassElementImpl classA = ElementFactory.classElement2("A");
String constructorName = "a";
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698