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

Side by Side Diff: pkg/analysis_server/test/search/member_declarations_test.dart

Issue 398093003: Fix for name declaration indexing in for-in statement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analysis_services/lib/src/index/index_contributor.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 test.search.member_declarations; 5 library test.search.member_declarations;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/computer/element.dart'; 9 import 'package:analysis_server/src/computer/element.dart';
10 import 'package:analysis_server/src/constants.dart'; 10 import 'package:analysis_server/src/constants.dart';
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 for (SearchResult result in results) { 55 for (SearchResult result in results) {
56 Element element = result.path[0]; 56 Element element = result.path[0];
57 Element clazz = result.path[1]; 57 Element clazz = result.path[1];
58 if (element.kind == kind && clazz.name == enclosingClass) { 58 if (element.kind == kind && clazz.name == enclosingClass) {
59 return result; 59 return result;
60 } 60 }
61 } 61 }
62 return null; 62 return null;
63 } 63 }
64 64
65 test_localVariable() {
66 addTestFile('''
67 class A {
68 main() {
69 var foo = 42;
70 }
71 }
72 ''');
73 return findMemberDeclarations('foo').then((_) {
74 expect(results, isEmpty);
75 });
76 }
77
78 test_localVariable_forIn() {
79 addTestFile('''
80 class A {
81 main() {
82 for (int foo in []) {
83 }
84 }
85 }
86 ''');
87 return findMemberDeclarations('foo').then((_) {
88 expect(results, isEmpty);
89 });
90 }
91
65 test_methodField() { 92 test_methodField() {
66 addTestFile(''' 93 addTestFile('''
67 class A { 94 class A {
68 foo() {} 95 foo() {}
69 bar() {} 96 bar() {}
70 } 97 }
71 class B { 98 class B {
72 int foo; 99 int foo;
73 } 100 }
74 '''); 101 ''');
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 set foo(x) {} 169 set foo(x) {}
143 } 170 }
144 '''); 171 ''');
145 return findMemberDeclarations('foo').then((_) { 172 return findMemberDeclarations('foo').then((_) {
146 expect(results, hasLength(2)); 173 expect(results, hasLength(2));
147 assertHasDeclaration(ElementKind.METHOD, 'A'); 174 assertHasDeclaration(ElementKind.METHOD, 'A');
148 assertHasDeclaration(ElementKind.SETTER, 'B'); 175 assertHasDeclaration(ElementKind.SETTER, 'B');
149 }); 176 });
150 } 177 }
151 } 178 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_services/lib/src/index/index_contributor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698