| OLD | NEW |
| 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.services.completion.util; | 5 library test.services.completion.util; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol.dart' as protocol | 9 import 'package:analysis_server/src/protocol.dart' as protocol |
| 10 show Element, ElementKind; | 10 show Element, ElementKind; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 protocol.Element element = cs.element; | 194 protocol.Element element = cs.element; |
| 195 expect(element, isNotNull); | 195 expect(element, isNotNull); |
| 196 expect(element.kind, equals(protocol.ElementKind.CLASS_TYPE_ALIAS)); | 196 expect(element.kind, equals(protocol.ElementKind.CLASS_TYPE_ALIAS)); |
| 197 expect(element.name, equals(name)); | 197 expect(element.name, equals(name)); |
| 198 expect(element.parameters, isNull); | 198 expect(element.parameters, isNull); |
| 199 expect(element.returnType, isNull); | 199 expect(element.returnType, isNull); |
| 200 assertHasNoParameterInfo(cs); | 200 assertHasNoParameterInfo(cs); |
| 201 return cs; | 201 return cs; |
| 202 } | 202 } |
| 203 | 203 |
| 204 CompletionSuggestion assertSuggestConstructor(String name) { | 204 CompletionSuggestion assertSuggestConstructor(String name, |
| 205 CompletionSuggestion cs = assertSuggest(name); | 205 {int relevance: DART_RELEVANCE_DEFAULT}) { |
| 206 CompletionSuggestion cs = assertSuggest(name, relevance: relevance); |
| 206 protocol.Element element = cs.element; | 207 protocol.Element element = cs.element; |
| 207 expect(element, isNotNull); | 208 expect(element, isNotNull); |
| 208 expect(element.kind, equals(protocol.ElementKind.CONSTRUCTOR)); | 209 expect(element.kind, equals(protocol.ElementKind.CONSTRUCTOR)); |
| 209 int index = name.indexOf('.'); | 210 int index = name.indexOf('.'); |
| 210 expect(element.name, index >= 0 ? name.substring(index + 1) : ''); | 211 expect(element.name, index >= 0 ? name.substring(index + 1) : ''); |
| 211 return cs; | 212 return cs; |
| 212 } | 213 } |
| 213 | 214 |
| 214 CompletionSuggestion assertSuggestField(String name, String type, | 215 CompletionSuggestion assertSuggestField(String name, String type, |
| 215 {int relevance: DART_RELEVANCE_DEFAULT, | 216 {int relevance: DART_RELEVANCE_DEFAULT, |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 CompletionSuggestion assertSuggestImportedClass(String name, | 564 CompletionSuggestion assertSuggestImportedClass(String name, |
| 564 {CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, | 565 {CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION, |
| 565 int relevance: DART_RELEVANCE_DEFAULT}) { | 566 int relevance: DART_RELEVANCE_DEFAULT}) { |
| 566 if (computer is ImportedComputer) { | 567 if (computer is ImportedComputer) { |
| 567 return assertSuggestClass(name, relevance: relevance, kind: kind); | 568 return assertSuggestClass(name, relevance: relevance, kind: kind); |
| 568 } else { | 569 } else { |
| 569 return assertNotSuggested(name); | 570 return assertNotSuggested(name); |
| 570 } | 571 } |
| 571 } | 572 } |
| 572 | 573 |
| 573 CompletionSuggestion assertSuggestImportedConstructor(String name) { | 574 CompletionSuggestion assertSuggestImportedConstructor(String name, |
| 575 {int relevance: DART_RELEVANCE_DEFAULT}) { |
| 574 return assertNotSuggested(name); | 576 return assertNotSuggested(name); |
| 575 } | 577 } |
| 576 | 578 |
| 577 CompletionSuggestion assertSuggestImportedField(String name, String type, | 579 CompletionSuggestion assertSuggestImportedField(String name, String type, |
| 578 {int relevance: DART_RELEVANCE_INHERITED_FIELD}) { | 580 {int relevance: DART_RELEVANCE_INHERITED_FIELD}) { |
| 579 return assertNotSuggested(name); | 581 return assertNotSuggested(name); |
| 580 } | 582 } |
| 581 | 583 |
| 582 CompletionSuggestion assertSuggestImportedFunction( | 584 CompletionSuggestion assertSuggestImportedFunction( |
| 583 String name, String returnType, | 585 String name, String returnType, |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 import 'dart:async'; | 821 import 'dart:async'; |
| 820 import '/libA.dart'; | 822 import '/libA.dart'; |
| 821 class B { } | 823 class B { } |
| 822 String bar() => true; | 824 String bar() => true; |
| 823 void main() {new A(^)}'''); | 825 void main() {new A(^)}'''); |
| 824 computeFast(); | 826 computeFast(); |
| 825 return computeFull((bool result) { | 827 return computeFull((bool result) { |
| 826 expect(request.replacementOffset, completionOffset); | 828 expect(request.replacementOffset, completionOffset); |
| 827 expect(request.replacementLength, 0); | 829 expect(request.replacementLength, 0); |
| 828 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 830 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
| 829 assertSuggestLocalFunction( | 831 assertSuggestLocalFunction('bar', 'String', |
| 830 'bar', 'String', kind: CompletionSuggestionKind.IDENTIFIER); | 832 kind: CompletionSuggestionKind.IDENTIFIER); |
| 831 assertSuggestImportedFunction('hasLength', 'bool', | 833 assertSuggestImportedFunction('hasLength', 'bool', |
| 832 kind: CompletionSuggestionKind.IDENTIFIER); | 834 kind: CompletionSuggestionKind.IDENTIFIER); |
| 833 assertSuggestImportedFunction('identical', 'bool', | 835 assertSuggestImportedFunction('identical', 'bool', |
| 834 kind: CompletionSuggestionKind.IDENTIFIER); | 836 kind: CompletionSuggestionKind.IDENTIFIER); |
| 835 assertSuggestLocalClass('B', kind: CompletionSuggestionKind.IDENTIFIER); | 837 assertSuggestLocalClass('B', kind: CompletionSuggestionKind.IDENTIFIER); |
| 836 assertSuggestImportedClass('A', | 838 assertSuggestImportedClass('A', |
| 837 kind: CompletionSuggestionKind.IDENTIFIER); | 839 kind: CompletionSuggestionKind.IDENTIFIER); |
| 838 assertSuggestImportedClass('Object', | 840 assertSuggestImportedClass('Object', |
| 839 kind: CompletionSuggestionKind.IDENTIFIER); | 841 kind: CompletionSuggestionKind.IDENTIFIER); |
| 840 assertNotSuggested('main'); | 842 assertNotSuggested('main'); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 855 import 'dart:async'; | 857 import 'dart:async'; |
| 856 import '/libA.dart'; | 858 import '/libA.dart'; |
| 857 class B { } | 859 class B { } |
| 858 String bar() => true; | 860 String bar() => true; |
| 859 void main() {new A(^)}'''); | 861 void main() {new A(^)}'''); |
| 860 computeFast(); | 862 computeFast(); |
| 861 return computeFull((bool result) { | 863 return computeFull((bool result) { |
| 862 expect(request.replacementOffset, completionOffset); | 864 expect(request.replacementOffset, completionOffset); |
| 863 expect(request.replacementLength, 0); | 865 expect(request.replacementLength, 0); |
| 864 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 866 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
| 865 assertSuggestLocalFunction( | 867 assertSuggestLocalFunction('bar', 'String', |
| 866 'bar', 'String', kind: CompletionSuggestionKind.IDENTIFIER); | 868 kind: CompletionSuggestionKind.IDENTIFIER); |
| 867 assertSuggestImportedFunction('hasLength', 'bool', | 869 assertSuggestImportedFunction('hasLength', 'bool', |
| 868 kind: CompletionSuggestionKind.IDENTIFIER); | 870 kind: CompletionSuggestionKind.IDENTIFIER); |
| 869 assertSuggestImportedFunction('identical', 'bool', | 871 assertSuggestImportedFunction('identical', 'bool', |
| 870 kind: CompletionSuggestionKind.IDENTIFIER); | 872 kind: CompletionSuggestionKind.IDENTIFIER); |
| 871 assertSuggestLocalClass('B', kind: CompletionSuggestionKind.IDENTIFIER); | 873 assertSuggestLocalClass('B', kind: CompletionSuggestionKind.IDENTIFIER); |
| 872 assertSuggestImportedClass('A', | 874 assertSuggestImportedClass('A', |
| 873 kind: CompletionSuggestionKind.IDENTIFIER); | 875 kind: CompletionSuggestionKind.IDENTIFIER); |
| 874 assertSuggestImportedClass('Object', | 876 assertSuggestImportedClass('Object', |
| 875 kind: CompletionSuggestionKind.IDENTIFIER); | 877 kind: CompletionSuggestionKind.IDENTIFIER); |
| 876 assertNotSuggested('main'); | 878 assertNotSuggested('main'); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 import 'dart:async'; | 948 import 'dart:async'; |
| 947 import '/libA.dart'; | 949 import '/libA.dart'; |
| 948 class B { } | 950 class B { } |
| 949 String bar(f()) => true; | 951 String bar(f()) => true; |
| 950 void main() {bar(^);}'''); | 952 void main() {bar(^);}'''); |
| 951 computeFast(); | 953 computeFast(); |
| 952 return computeFull((bool result) { | 954 return computeFull((bool result) { |
| 953 expect(request.replacementOffset, completionOffset); | 955 expect(request.replacementOffset, completionOffset); |
| 954 expect(request.replacementLength, 0); | 956 expect(request.replacementLength, 0); |
| 955 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 957 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
| 956 assertSuggestLocalFunction( | 958 assertSuggestLocalFunction('bar', 'String', |
| 957 'bar', 'String', kind: CompletionSuggestionKind.IDENTIFIER); | 959 kind: CompletionSuggestionKind.IDENTIFIER); |
| 958 assertSuggestImportedFunction('hasLength', 'bool', | 960 assertSuggestImportedFunction('hasLength', 'bool', |
| 959 kind: CompletionSuggestionKind.IDENTIFIER); | 961 kind: CompletionSuggestionKind.IDENTIFIER); |
| 960 assertSuggestImportedFunction('identical', 'bool', | 962 assertSuggestImportedFunction('identical', 'bool', |
| 961 kind: CompletionSuggestionKind.IDENTIFIER); | 963 kind: CompletionSuggestionKind.IDENTIFIER); |
| 962 assertSuggestLocalClass('B', kind: CompletionSuggestionKind.IDENTIFIER); | 964 assertSuggestLocalClass('B', kind: CompletionSuggestionKind.IDENTIFIER); |
| 963 assertSuggestImportedClass('A', | 965 assertSuggestImportedClass('A', |
| 964 kind: CompletionSuggestionKind.IDENTIFIER); | 966 kind: CompletionSuggestionKind.IDENTIFIER); |
| 965 assertSuggestImportedClass('Object', | 967 assertSuggestImportedClass('Object', |
| 966 kind: CompletionSuggestionKind.IDENTIFIER); | 968 kind: CompletionSuggestionKind.IDENTIFIER); |
| 967 assertNotSuggested('main'); | 969 assertNotSuggested('main'); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 980 addTestSource(''' | 982 addTestSource(''' |
| 981 import 'dart:async'; | 983 import 'dart:async'; |
| 982 import '/libA.dart'; | 984 import '/libA.dart'; |
| 983 class B { String bar(f()) => true; } | 985 class B { String bar(f()) => true; } |
| 984 void main() {new B().bar(^);}'''); | 986 void main() {new B().bar(^);}'''); |
| 985 computeFast(); | 987 computeFast(); |
| 986 return computeFull((bool result) { | 988 return computeFull((bool result) { |
| 987 expect(request.replacementOffset, completionOffset); | 989 expect(request.replacementOffset, completionOffset); |
| 988 expect(request.replacementLength, 0); | 990 expect(request.replacementLength, 0); |
| 989 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); | 991 assertNoSuggestions(kind: CompletionSuggestionKind.ARGUMENT_LIST); |
| 990 assertSuggestImportedFunction( | 992 assertSuggestImportedFunction('hasLength', 'bool', |
| 991 'hasLength', 'bool', kind: CompletionSuggestionKind.IDENTIFIER); | 993 kind: CompletionSuggestionKind.IDENTIFIER); |
| 992 assertSuggestImportedFunction('identical', 'bool', | 994 assertSuggestImportedFunction('identical', 'bool', |
| 993 kind: CompletionSuggestionKind.IDENTIFIER); | 995 kind: CompletionSuggestionKind.IDENTIFIER); |
| 994 assertSuggestLocalClass('B', kind: CompletionSuggestionKind.IDENTIFIER); | 996 assertSuggestLocalClass('B', kind: CompletionSuggestionKind.IDENTIFIER); |
| 995 assertSuggestImportedClass('A', | 997 assertSuggestImportedClass('A', |
| 996 kind: CompletionSuggestionKind.IDENTIFIER); | 998 kind: CompletionSuggestionKind.IDENTIFIER); |
| 997 assertSuggestImportedClass('Object', | 999 assertSuggestImportedClass('Object', |
| 998 kind: CompletionSuggestionKind.IDENTIFIER); | 1000 kind: CompletionSuggestionKind.IDENTIFIER); |
| 999 assertNotSuggested('main'); | 1001 assertNotSuggested('main'); |
| 1000 assertNotSuggested('baz'); | 1002 assertNotSuggested('baz'); |
| 1001 assertNotSuggested('print'); | 1003 assertNotSuggested('print'); |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 String T1; | 1311 String T1; |
| 1310 var _T2; | 1312 var _T2; |
| 1311 class C { } | 1313 class C { } |
| 1312 class D { }'''); | 1314 class D { }'''); |
| 1313 addSource('/testEEF.dart', ''' | 1315 addSource('/testEEF.dart', ''' |
| 1314 class EE { } | 1316 class EE { } |
| 1315 class F { }'''); | 1317 class F { }'''); |
| 1316 addSource('/testG.dart', 'class G { }'); | 1318 addSource('/testG.dart', 'class G { }'); |
| 1317 addSource('/testH.dart', ''' | 1319 addSource('/testH.dart', ''' |
| 1318 class H { } | 1320 class H { } |
| 1321 class D3 { } |
| 1319 int T3; | 1322 int T3; |
| 1320 var _T4;'''); // not imported | 1323 var _T4;'''); // not imported |
| 1321 addTestSource(''' | 1324 addTestSource(''' |
| 1322 import "/testAB.dart"; | 1325 import "/testAB.dart"; |
| 1323 import "/testCD.dart" hide D; | 1326 import "/testCD.dart" hide D; |
| 1324 import "/testEEF.dart" show EE; | 1327 import "/testEEF.dart" show EE; |
| 1325 import "/testG.dart" as g; | 1328 import "/testG.dart" as g; |
| 1326 int T5; | 1329 int T5; |
| 1327 var _T6; | 1330 var _T6; |
| 1328 Z D2() {int x;} | 1331 Z D2() {int x;} |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1341 // Don't suggest locals out of scope | 1344 // Don't suggest locals out of scope |
| 1342 assertNotSuggested('r'); | 1345 assertNotSuggested('r'); |
| 1343 assertNotSuggested('x'); | 1346 assertNotSuggested('x'); |
| 1344 | 1347 |
| 1345 // imported elements are portially filtered | 1348 // imported elements are portially filtered |
| 1346 //assertSuggestImportedClass('A'); | 1349 //assertSuggestImportedClass('A'); |
| 1347 assertNotSuggested('_B'); | 1350 assertNotSuggested('_B'); |
| 1348 //assertSuggestImportedClass('C'); | 1351 //assertSuggestImportedClass('C'); |
| 1349 // hidden element suggested as low relevance | 1352 // hidden element suggested as low relevance |
| 1350 assertSuggestImportedClass('D', relevance: DART_RELEVANCE_LOW); | 1353 assertSuggestImportedClass('D', relevance: DART_RELEVANCE_LOW); |
| 1351 assertSuggestImportedFunction( | 1354 assertSuggestImportedFunction('D1', null, |
| 1352 'D1', null, deprecated: true, relevance: DART_RELEVANCE_LOW); | 1355 deprecated: true, relevance: DART_RELEVANCE_LOW); |
| 1353 assertSuggestLocalFunction('D2', 'Z'); | 1356 assertSuggestLocalFunction('D2', 'Z'); |
| 1357 // unimported elements suggested with low relevance |
| 1358 assertSuggestImportedClass('D3', relevance: DART_RELEVANCE_LOW); |
| 1354 //assertSuggestImportedClass('EE'); | 1359 //assertSuggestImportedClass('EE'); |
| 1355 // hidden element suggested as low relevance | 1360 // hidden element suggested as low relevance |
| 1356 //assertSuggestImportedClass('F', COMPLETION_RELEVANCE_LOW); | 1361 //assertSuggestImportedClass('F', COMPLETION_RELEVANCE_LOW); |
| 1357 //assertSuggestLibraryPrefix('g'); | 1362 //assertSuggestLibraryPrefix('g'); |
| 1358 assertNotSuggested('G'); | 1363 assertNotSuggested('G'); |
| 1359 //assertSuggestImportedClass('H', COMPLETION_RELEVANCE_LOW); | 1364 //assertSuggestImportedClass('H', COMPLETION_RELEVANCE_LOW); |
| 1360 //assertSuggestImportedClass('Object'); | 1365 //assertSuggestImportedClass('Object'); |
| 1361 //assertSuggestImportedFunction('min', 'num', false); | 1366 //assertSuggestImportedFunction('min', 'num', false); |
| 1362 //assertSuggestImportedFunction( | 1367 //assertSuggestImportedFunction( |
| 1363 // 'max', | 1368 // 'max', |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1426 assertSuggestLocalField('m1', null); | 1431 assertSuggestLocalField('m1', null); |
| 1427 assertSuggestLocalGetter('f3', null); | 1432 assertSuggestLocalGetter('f3', null); |
| 1428 assertSuggestLocalSetter('f4'); | 1433 assertSuggestLocalSetter('f4'); |
| 1429 assertSuggestLocalMethod('e2', 'E', null); | 1434 assertSuggestLocalMethod('e2', 'E', null); |
| 1430 assertSuggestLocalMethod('f2', 'F', null); | 1435 assertSuggestLocalMethod('f2', 'F', null); |
| 1431 assertSuggestLocalMethod('i2', 'I', null); | 1436 assertSuggestLocalMethod('i2', 'I', null); |
| 1432 assertSuggestLocalMethod('m2', 'M', 'int'); | 1437 assertSuggestLocalMethod('m2', 'M', 'int'); |
| 1433 }); | 1438 }); |
| 1434 } | 1439 } |
| 1435 | 1440 |
| 1441 test_Block_unimported() { |
| 1442 addSource('/testAB.dart', 'class Foo { }'); |
| 1443 addTestSource('class C {foo(){F^}}'); |
| 1444 computeFast(); |
| 1445 return computeFull((bool result) { |
| 1446 expect(request.replacementOffset, completionOffset - 1); |
| 1447 expect(request.replacementLength, 1); |
| 1448 assertSuggestImportedClass('Foo', relevance: DART_RELEVANCE_LOW); |
| 1449 assertSuggestImportedClass('Future', relevance: DART_RELEVANCE_LOW); |
| 1450 }); |
| 1451 } |
| 1452 |
| 1436 test_CascadeExpression_selector1() { | 1453 test_CascadeExpression_selector1() { |
| 1437 // PropertyAccess CascadeExpression ExpressionStatement Block | 1454 // PropertyAccess CascadeExpression ExpressionStatement Block |
| 1438 addSource('/testB.dart', ''' | 1455 addSource('/testB.dart', ''' |
| 1439 class B { }'''); | 1456 class B { }'''); |
| 1440 addTestSource(''' | 1457 addTestSource(''' |
| 1441 import "/testB.dart"; | 1458 import "/testB.dart"; |
| 1442 class A {var b; X _c;} | 1459 class A {var b; X _c;} |
| 1443 class X{} | 1460 class X{} |
| 1444 // looks like a cascade to the parser | 1461 // looks like a cascade to the parser |
| 1445 // but the user is trying to get completions for a non-cascade | 1462 // but the user is trying to get completions for a non-cascade |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2351 } | 2368 } |
| 2352 | 2369 |
| 2353 test_InstanceCreationExpression_imported() { | 2370 test_InstanceCreationExpression_imported() { |
| 2354 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression | 2371 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression |
| 2355 addSource('/testA.dart', ''' | 2372 addSource('/testA.dart', ''' |
| 2356 int T1; | 2373 int T1; |
| 2357 F1() { } | 2374 F1() { } |
| 2358 class A {A(this.x) { } int x;}'''); | 2375 class A {A(this.x) { } int x;}'''); |
| 2359 addTestSource(''' | 2376 addTestSource(''' |
| 2360 import "/testA.dart"; | 2377 import "/testA.dart"; |
| 2378 import "dart:async"; |
| 2361 int T2; | 2379 int T2; |
| 2362 F2() { } | 2380 F2() { } |
| 2363 class B {B(this.x, [String boo]) { } int x;} | 2381 class B {B(this.x, [String boo]) { } int x;} |
| 2364 class C {foo(){var f; {var x;} new ^}}'''); | 2382 class C {foo(){var f; {var x;} new ^}}'''); |
| 2365 computeFast(); | 2383 computeFast(); |
| 2366 return computeFull((bool result) { | 2384 return computeFull((bool result) { |
| 2367 expect(request.replacementOffset, completionOffset); | 2385 expect(request.replacementOffset, completionOffset); |
| 2368 expect(request.replacementLength, 0); | 2386 expect(request.replacementLength, 0); |
| 2369 assertSuggestImportedConstructor('Object'); | 2387 assertSuggestImportedConstructor('Object'); |
| 2388 assertSuggestImportedConstructor('Future'); |
| 2370 assertSuggestImportedConstructor('A'); | 2389 assertSuggestImportedConstructor('A'); |
| 2371 assertSuggestLocalConstructor('B'); | 2390 assertSuggestLocalConstructor('B'); |
| 2372 assertSuggestLocalConstructor('C'); | 2391 assertSuggestLocalConstructor('C'); |
| 2373 assertNotSuggested('f'); | 2392 assertNotSuggested('f'); |
| 2374 assertNotSuggested('x'); | 2393 assertNotSuggested('x'); |
| 2375 assertNotSuggested('foo'); | 2394 assertNotSuggested('foo'); |
| 2376 assertNotSuggested('F1'); | 2395 assertNotSuggested('F1'); |
| 2377 assertNotSuggested('F2'); | 2396 assertNotSuggested('F2'); |
| 2378 assertNotSuggested('T1'); | 2397 assertNotSuggested('T1'); |
| 2379 assertNotSuggested('T2'); | 2398 assertNotSuggested('T2'); |
| 2380 }); | 2399 }); |
| 2381 } | 2400 } |
| 2382 | 2401 |
| 2402 test_InstanceCreationExpression_unimported() { |
| 2403 // SimpleIdentifier TypeName ConstructorName InstanceCreationExpression |
| 2404 addSource('/testAB.dart', 'class Foo { }'); |
| 2405 addTestSource('class C {foo(){new F^}}'); |
| 2406 computeFast(); |
| 2407 return computeFull((bool result) { |
| 2408 expect(request.replacementOffset, completionOffset - 1); |
| 2409 expect(request.replacementLength, 1); |
| 2410 assertSuggestImportedConstructor('Foo', relevance: DART_RELEVANCE_LOW); |
| 2411 assertSuggestImportedConstructor('Future', relevance: DART_RELEVANCE_LOW); |
| 2412 }); |
| 2413 } |
| 2414 |
| 2383 test_InterpolationExpression() { | 2415 test_InterpolationExpression() { |
| 2384 // SimpleIdentifier InterpolationExpression StringInterpolation | 2416 // SimpleIdentifier InterpolationExpression StringInterpolation |
| 2385 addSource('/testA.dart', ''' | 2417 addSource('/testA.dart', ''' |
| 2386 int T1; | 2418 int T1; |
| 2387 F1() { } | 2419 F1() { } |
| 2388 typedef D1(); | 2420 typedef D1(); |
| 2389 class C1 {C1(this.x) { } int x;}'''); | 2421 class C1 {C1(this.x) { } int x;}'''); |
| 2390 addTestSource(''' | 2422 addTestSource(''' |
| 2391 import "/testA.dart"; | 2423 import "/testA.dart"; |
| 2392 int T2; | 2424 int T2; |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3623 assertNotSuggested('bar2'); | 3655 assertNotSuggested('bar2'); |
| 3624 assertNotSuggested('_B'); | 3656 assertNotSuggested('_B'); |
| 3625 assertSuggestLocalClass('Y'); | 3657 assertSuggestLocalClass('Y'); |
| 3626 assertSuggestLocalClass('C'); | 3658 assertSuggestLocalClass('C'); |
| 3627 assertSuggestLocalVariable('f', null); | 3659 assertSuggestLocalVariable('f', null); |
| 3628 assertNotSuggested('x'); | 3660 assertNotSuggested('x'); |
| 3629 assertNotSuggested('e'); | 3661 assertNotSuggested('e'); |
| 3630 }); | 3662 }); |
| 3631 } | 3663 } |
| 3632 } | 3664 } |
| OLD | NEW |