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

Side by Side Diff: pkg/analysis_server/test/services/completion/completion_test_util.dart

Issue 686843003: add type static constants suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart ('k') | no next file » | 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.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 show Element, 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element,
10 ElementKind; 10 ElementKind;
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 assertNotSuggested('m'); 1407 assertNotSuggested('m');
1408 assertNotSuggested('_n'); 1408 assertNotSuggested('_n');
1409 assertNotSuggested('a'); 1409 assertNotSuggested('a');
1410 assertNotSuggested('A'); 1410 assertNotSuggested('A');
1411 assertNotSuggested('X'); 1411 assertNotSuggested('X');
1412 assertNotSuggested('Object'); 1412 assertNotSuggested('Object');
1413 assertNotSuggested('=='); 1413 assertNotSuggested('==');
1414 }); 1414 });
1415 } 1415 }
1416 1416
1417 test_PrefixedIdentifier_class_const() {
1418 // SimpleIdentifier PrefixedIdentifier ExpressionStatement Block
1419 addSource('/testB.dart', '''
1420 lib B;
1421 class I {
1422 static const scI = 'boo';
1423 X get f => new A();
1424 get _g => new A();}
1425 class B implements I {
1426 static const int scB = 12;
1427 var b; X _c;
1428 X get d => new A();get _e => new A();
1429 set s1(I x) {} set _s2(I x) {}
1430 m(X x) {} I _n(X x) {}}
1431 class X{}''');
1432 addTestSource('''
1433 import "/testB.dart";
1434 class A extends B {
1435 static const String scA = 'foo';
1436 w() { }}
1437 main() {A.^}''');
1438 computeFast();
1439 return computeFull(true).then((_) {
1440 assertSuggestInvocationGetter('scA', 'String');
1441 assertSuggestInvocationGetter('scB', 'int');
1442 assertSuggestInvocationGetter('scI', null);
1443 assertNotSuggested('b');
1444 assertNotSuggested('_c');
1445 assertNotSuggested('d');
1446 assertNotSuggested('_e');
1447 assertNotSuggested('f');
1448 assertNotSuggested('_g');
1449 assertNotSuggested('s1');
1450 assertNotSuggested('_s2');
1451 assertNotSuggested('m');
1452 assertNotSuggested('_n');
1453 assertNotSuggested('a');
1454 assertNotSuggested('A');
1455 assertNotSuggested('X');
1456 assertNotSuggested('w');
1457 assertNotSuggested('Object');
1458 assertNotSuggested('==');
1459 });
1460 }
1461
1417 test_PrefixedIdentifier_class_imported() { 1462 test_PrefixedIdentifier_class_imported() {
1418 // SimpleIdentifier PrefixedIdentifier ExpressionStatement 1463 // SimpleIdentifier PrefixedIdentifier ExpressionStatement
1419 addSource('/testB.dart', ''' 1464 addSource('/testB.dart', '''
1420 lib B; 1465 lib B;
1421 class I {X get f => new A();get _g => new A();} 1466 class I {X get f => new A();get _g => new A();}
1422 class A implements I { 1467 class A implements I {
1468 static const int sc = 12;
1423 var b; X _c; 1469 var b; X _c;
1424 X get d => new A();get _e => new A(); 1470 X get d => new A();get _e => new A();
1425 set s1(I x) {} set _s2(I x) {} 1471 set s1(I x) {} set _s2(I x) {}
1426 m(X x) {} I _n(X x) {}} 1472 m(X x) {} I _n(X x) {}}
1427 class X{}'''); 1473 class X{}''');
1428 addTestSource(''' 1474 addTestSource('''
1429 import "/testB.dart"; 1475 import "/testB.dart";
1430 main() {A a; a.^}'''); 1476 main() {A a; a.^}''');
1431 computeFast(); 1477 computeFast();
1432 return computeFull(true).then((_) { 1478 return computeFull(true).then((_) {
1479 assertSuggestInvocationGetter('sc', 'int');
1433 assertSuggestInvocationGetter('b', null); 1480 assertSuggestInvocationGetter('b', null);
1434 assertNotSuggested('_c'); 1481 assertNotSuggested('_c');
1435 assertSuggestInvocationGetter('d', 'X'); 1482 assertSuggestInvocationGetter('d', 'X');
1436 assertNotSuggested('_e'); 1483 assertNotSuggested('_e');
1437 assertSuggestInvocationGetter('f', 'X'); 1484 assertSuggestInvocationGetter('f', 'X');
1438 assertNotSuggested('_g'); 1485 assertNotSuggested('_g');
1439 assertSuggestInvocationSetter('s1'); 1486 assertSuggestInvocationSetter('s1');
1440 assertNotSuggested('_s2'); 1487 assertNotSuggested('_s2');
1441 assertSuggestInvocationMethod('m', 'A', null); 1488 assertSuggestInvocationMethod('m', 'A', null);
1442 assertNotSuggested('_n'); 1489 assertNotSuggested('_n');
1443 assertNotSuggested('a'); 1490 assertNotSuggested('a');
1444 assertNotSuggested('A'); 1491 assertNotSuggested('A');
1445 assertNotSuggested('X'); 1492 assertNotSuggested('X');
1446 assertNotSuggested('Object'); 1493 assertNotSuggested('Object');
1447 assertNotSuggested('=='); 1494 assertNotSuggested('==');
1448 }); 1495 });
1449 } 1496 }
1450 1497
1451 test_PrefixedIdentifier_class_local() { 1498 test_PrefixedIdentifier_class_local() {
1452 // SimpleIdentifier PrefixedIdentifier ExpressionStatement 1499 // SimpleIdentifier PrefixedIdentifier ExpressionStatement
1453 addTestSource(''' 1500 addTestSource('''
1454 main() {A a; a.^} 1501 main() {A a; a.^}
1455 class I {X get f => new A();get _g => new A();} 1502 class I {X get f => new A();get _g => new A();}
1456 class A implements I { 1503 class A implements I {
1504 static const int sc = 12;
1457 var b; X _c; 1505 var b; X _c;
1458 X get d => new A();get _e => new A(); 1506 X get d => new A();get _e => new A();
1459 set s1(I x) {} set _s2(I x) {} 1507 set s1(I x) {} set _s2(I x) {}
1460 m(X x) {} I _n(X x) {}} 1508 m(X x) {} I _n(X x) {}}
1461 class X{}'''); 1509 class X{}''');
1462 computeFast(); 1510 computeFast();
1463 return computeFull(true).then((_) { 1511 return computeFull(true).then((_) {
1512 assertSuggestInvocationGetter('sc', 'int');
1464 assertSuggestInvocationGetter('b', null); 1513 assertSuggestInvocationGetter('b', null);
1465 assertSuggestInvocationGetter('_c', 'X'); 1514 assertSuggestInvocationGetter('_c', 'X');
1466 assertSuggestInvocationGetter('d', 'X'); 1515 assertSuggestInvocationGetter('d', 'X');
1467 assertSuggestInvocationGetter('_e', null); 1516 assertSuggestInvocationGetter('_e', null);
1468 assertSuggestInvocationGetter('f', 'X'); 1517 assertSuggestInvocationGetter('f', 'X');
1469 assertSuggestInvocationGetter('_g', null); 1518 assertSuggestInvocationGetter('_g', null);
1470 assertSuggestInvocationSetter('s1'); 1519 assertSuggestInvocationSetter('s1');
1471 assertSuggestInvocationSetter('_s2'); 1520 assertSuggestInvocationSetter('_s2');
1472 assertSuggestInvocationMethod('m', 'A', null); 1521 assertSuggestInvocationMethod('m', 'A', null);
1473 assertSuggestInvocationMethod('_n', 'A', 'I'); 1522 assertSuggestInvocationMethod('_n', 'A', 'I');
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 assertNotSuggested('bar2'); 1711 assertNotSuggested('bar2');
1663 assertNotSuggested('_B'); 1712 assertNotSuggested('_B');
1664 assertSuggestLocalClass('Y'); 1713 assertSuggestLocalClass('Y');
1665 assertSuggestLocalClass('C'); 1714 assertSuggestLocalClass('C');
1666 assertSuggestLocalVariable('f', null); 1715 assertSuggestLocalVariable('f', null);
1667 assertNotSuggested('x'); 1716 assertNotSuggested('x');
1668 assertNotSuggested('e'); 1717 assertNotSuggested('e');
1669 }); 1718 });
1670 } 1719 }
1671 } 1720 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/suggestion_builder.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698