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

Unified Diff: pkg/analysis_server/test/services/completion/completion_test_util.dart

Issue 802163002: include local functions in completion suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 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/analysis_server/test/completion_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/completion_test_util.dart
diff --git a/pkg/analysis_server/test/services/completion/completion_test_util.dart b/pkg/analysis_server/test/services/completion/completion_test_util.dart
index 10d6020e6290ce88b1bb491fba0060ed42aff17a..8635447b7f58f6d9ca9ff0f9ec84542eb1913c28 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -1007,7 +1007,14 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
int T5;
var _T6;
Z D2() {int x;}
- class X {a() {var f; {var x;} ^ var r;} void b() { }}
+ class X {
+ a() {
+ var f;
+ localF(int arg1) { }
+ {var x;}
+ ^ var r;
+ }
+ void b() { }}
class Z { }''');
computeFast();
return computeFull((bool result) {
@@ -1016,6 +1023,7 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
assertSuggestLocalClass('Z');
assertLocalSuggestMethod('a', 'X', null);
assertLocalSuggestMethod('b', 'X', 'void');
+ assertSuggestLocalFunction('localF', null);
assertSuggestLocalVariable('f', null);
// Don't suggest locals out of scope
assertNotSuggested('r');
@@ -2115,6 +2123,76 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
});
}
+ test_ThisExpression_block() {
+ // MethodInvocation ExpressionStatement Block
+ addTestSource('''
+ main() { }
+ class I {X get f => new A();get _g => new A();}
+ class A implements I {
+ A() {}
+ A.z() {}
+ var b; X _c;
+ X get d => new A();get _e => new A();
+ // no semicolon between completion point and next statement
+ set s1(I x) {} set _s2(I x) {this.^ m(null);}
+ m(X x) {} I _n(X x) {}}
+ class X{}''');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('b', null);
+ assertSuggestInvocationGetter('_c', 'X');
+ assertSuggestInvocationGetter('d', 'X');
+ assertSuggestInvocationGetter('_e', null);
+ assertSuggestInvocationGetter('f', 'X');
+ assertSuggestInvocationGetter('_g', null);
+ assertSuggestInvocationMethod('m', 'A', null);
+ assertSuggestInvocationMethod('_n', 'A', 'I');
+ assertSuggestInvocationSetter('s1');
+ assertSuggestInvocationSetter('_s2');
+ assertNotSuggested('z');
+ assertNotSuggested('I');
+ assertNotSuggested('A');
+ assertNotSuggested('X');
+ assertNotSuggested('Object');
+ assertNotSuggested('==');
+ });
+ }
+
+ test_ThisExpression_constructor() {
+ // MethodInvocation ExpressionStatement Block
+ addTestSource('''
+ main() { }
+ class I {X get f => new A();get _g => new A();}
+ class A implements I {
+ A() {this.^}
+ A.z() {}
+ var b; X _c;
+ X get d => new A();get _e => new A();
+ // no semicolon between completion point and next statement
+ set s1(I x) {} set _s2(I x) {m(null);}
+ m(X x) {} I _n(X x) {}}
+ class X{}''');
+ computeFast();
+ return computeFull((bool result) {
+ assertSuggestInvocationGetter('b', null);
+ assertSuggestInvocationGetter('_c', 'X');
+ assertSuggestInvocationGetter('d', 'X');
+ assertSuggestInvocationGetter('_e', null);
+ assertSuggestInvocationGetter('f', 'X');
+ assertSuggestInvocationGetter('_g', null);
+ assertSuggestInvocationMethod('m', 'A', null);
+ assertSuggestInvocationMethod('_n', 'A', 'I');
+ assertSuggestInvocationSetter('s1');
+ assertSuggestInvocationSetter('_s2');
+ assertNotSuggested('z');
+ assertNotSuggested('I');
+ assertNotSuggested('A');
+ assertNotSuggested('X');
+ assertNotSuggested('Object');
+ assertNotSuggested('==');
+ });
+ }
+
test_TopLevelVariableDeclaration_typed_name() {
// SimpleIdentifier VariableDeclaration VariableDeclarationList
// TopLevelVariableDeclaration
« no previous file with comments | « pkg/analysis_server/test/completion_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698