mirror of
https://github.com/dart-lang/sdk
synced 2024-10-01 19:29:09 +00:00
improve completion for formal param initializers
R=pquitslund@google.com Review-Url: https://codereview.chromium.org/2864233002 .
This commit is contained in:
parent
a4eb8b8fe3
commit
959b7c14b8
|
@ -208,6 +208,13 @@ class _KeywordVisitor extends GeneralizingAstVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
visitDefaultFormalParameter(DefaultFormalParameter node) {
|
||||
if (entity == node.defaultValue) {
|
||||
_addExpressionKeywords(node);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
visitExpression(Expression node) {
|
||||
_addExpressionKeywords(node);
|
||||
|
|
|
@ -1573,6 +1573,34 @@ class A {
|
|||
expect(suggestions, isEmpty);
|
||||
}
|
||||
|
||||
test_method_param_named_init() async {
|
||||
addTestSource('class A { foo({bool bar: ^}) {}}');
|
||||
await computeSuggestions();
|
||||
expect(suggestions, isNotEmpty);
|
||||
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
|
||||
}
|
||||
|
||||
test_method_param_named_init2() async {
|
||||
addTestSource('class A { foo({bool bar: f^}) {}}');
|
||||
await computeSuggestions();
|
||||
expect(suggestions, isNotEmpty);
|
||||
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
|
||||
}
|
||||
|
||||
test_method_param_positional_init() async {
|
||||
addTestSource('class A { foo([bool bar = ^]) {}}');
|
||||
await computeSuggestions();
|
||||
expect(suggestions, isNotEmpty);
|
||||
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
|
||||
}
|
||||
|
||||
test_method_param_positional_init2() async {
|
||||
addTestSource('class A { foo([bool bar = f^]) {}}');
|
||||
await computeSuggestions();
|
||||
expect(suggestions, isNotEmpty);
|
||||
assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
|
||||
}
|
||||
|
||||
test_named_constructor_invocation() async {
|
||||
addTestSource('void main() {new Future.^}');
|
||||
await computeSuggestions();
|
||||
|
|
Loading…
Reference in a new issue