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

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

Issue 908493003: filter static methods when showing instance completions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 10 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/analysis_server/test/services/completion/completion_test_util.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/invocation_computer_test.dart
diff --git a/pkg/analysis_server/test/services/completion/invocation_computer_test.dart b/pkg/analysis_server/test/services/completion/invocation_computer_test.dart
index 6b9886bb68a8a478248db0a7a44a41f6347b82f3..4025bdbc2f93e7a858a7a302c6413b9167643bc8 100644
--- a/pkg/analysis_server/test/services/completion/invocation_computer_test.dart
+++ b/pkg/analysis_server/test/services/completion/invocation_computer_test.dart
@@ -153,20 +153,6 @@ void f(C<int> c) {
});
}
- test_param() {
- addTestSource('foo(String x) {x.^}');
- return computeFull((bool result) {
- assertSuggestGetter('length', 'int');
- });
- }
-
- test_param_is() {
- addTestSource('foo(x) {if (x is String) x.^}');
- return computeFull((bool result) {
- assertSuggestGetter('length', 'int');
- });
- }
-
test_method_parameters_mixed_required_and_named() {
addTestSource('''
class C {
@@ -309,6 +295,92 @@ void main() {int y = new C().^}''');
});
}
+ test_only_instance() {
+ // SimpleIdentifier PropertyAccess ExpressionStatement
+ addTestSource('''
+class C {
+ int f1;
+ static int f2;
+ m1() {}
+ static m2() {}
+}
+void main() {new C().^}''');
+ return computeFull((bool result) {
+ assertSuggestInvocationField('f1', 'int');
+ assertNotSuggested('f2');
+ assertSuggestMethod('m1', 'C', null);
+ assertNotSuggested('m2');
+ });
+ }
+
+ test_only_instance2() {
+ // SimpleIdentifier MethodInvocation ExpressionStatement
+ addTestSource('''
+class C {
+ int f1;
+ static int f2;
+ m1() {}
+ static m2() {}
+}
+void main() {new C().^ print("something");}''');
+ return computeFull((bool result) {
+ assertSuggestInvocationField('f1', 'int');
+ assertNotSuggested('f2');
+ assertSuggestMethod('m1', 'C', null);
+ assertNotSuggested('m2');
+ });
+ }
+
+ test_only_static() {
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
+ addTestSource('''
+class C {
+ int f1;
+ static int f2;
+ m1() {}
+ static m2() {}
+}
+void main() {C.^}''');
+ return computeFull((bool result) {
+ assertNotSuggested('f1');
+ assertSuggestInvocationField('f2', 'int');
+ assertNotSuggested('m1');
+ assertSuggestMethod('m2', 'C', null);
+ });
+ }
+
+ test_only_static2() {
+ // SimpleIdentifier MethodInvocation ExpressionStatement
+ addTestSource('''
+class C {
+ int f1;
+ static int f2;
+ m1() {}
+ static m2() {}
+}
+void main() {C.^ print("something");}''');
+ return computeFull((bool result) {
+ assertNotSuggested('f1');
+ assertSuggestInvocationField('f2', 'int');
+ assertNotSuggested('m1');
+ assertSuggestMethod('m2', 'C', null);
+ });
+ }
+
+ test_param() {
+ addTestSource('foo(String x) {x.^}');
+ return computeFull((bool result) {
+ assertSuggestGetter('length', 'int');
+ });
+ }
+
+ test_param_is() {
+ addTestSource('foo(x) {if (x is String) x.^}');
+ return computeFull((bool result) {
+ assertSuggestGetter('length', 'int');
+ });
+ }
+
test_shadowing_field_over_field() =>
check_shadowing('int x;', 'int x;', true);
« no previous file with comments | « pkg/analysis_server/test/services/completion/completion_test_util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698