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

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

Issue 1396693004: Fix for top level variable documention ranges. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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/resolver.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/all_the_rest_test.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index cabe5d7d50f1bd90c5cd8693df4d6d0febed1e62..4e2652e354e695489826d3326e952188c5f34ab5 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -6673,6 +6673,34 @@ class ElementBuilderTest extends EngineTestCase {
expect(variable.setter, isNull);
}
+ void test_visitVariableDeclaration_top_docRange() {
+ // final a, b;
+ ElementHolder holder = new ElementHolder();
+ ElementBuilder builder = new ElementBuilder(holder);
+ VariableDeclaration variableDeclaration1 =
+ AstFactory.variableDeclaration('a');
+ VariableDeclaration variableDeclaration2 =
+ AstFactory.variableDeclaration('b');
+ TopLevelVariableDeclaration topLevelVariableDeclaration = AstFactory
+ .topLevelVariableDeclaration(
+ Keyword.FINAL, null, [variableDeclaration1, variableDeclaration2]);
+ topLevelVariableDeclaration.documentationComment = AstFactory
+ .documentationComment(
+ [TokenFactory.tokenFromString('/// aaa')..offset = 50], []);
+
+ topLevelVariableDeclaration.accept(builder);
+ List<TopLevelVariableElement> variables = holder.topLevelVariables;
+ expect(variables, hasLength(2));
+
+ TopLevelVariableElement variable1 = variables[0];
+ expect(variable1, isNotNull);
+ _assertHasDocRange(variable1, 50, 7);
+
+ TopLevelVariableElement variable2 = variables[1];
+ expect(variable2, isNotNull);
+ _assertHasDocRange(variable2, 50, 7);
+ }
+
void test_visitVariableDeclaration_top_final() {
// final v;
ElementHolder holder = new ElementHolder();
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698