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

Unified Diff: pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart

Issue 1528633002: move LocalReferenceContributor to new API (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: make local functions private' Created 5 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
Index: pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
diff --git a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
index 7762e9e9a69306d25fc772aaffe2ce310b43e74f..088ff77e977e347323cc1ae6d362e2338aee101c 100644
--- a/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
+++ b/pkg/analysis_server/lib/src/provisional/completion/dart/completion_target.dart
@@ -266,14 +266,10 @@ class CompletionTarget {
* The target [AstNode] hierarchy *must* be resolved for this to work.
*/
bool isFunctionalArgument() {
- if (argIndex == null) {
- return false;
- }
- AstNode argList = containingNode;
- if (argList is! ArgumentList) {
+ if (!maybeFunctionalArgument()) {
return false;
}
- AstNode parent = argList.parent;
+ AstNode parent = containingNode.parent;
if (parent is InstanceCreationExpression) {
DartType instType = parent.bestType;
if (instType != null) {
@@ -302,6 +298,21 @@ class CompletionTarget {
}
/**
+ * Return `true` if the target is a functional argument in an argument list.
+ * The target [AstNode] hierarchy *must* be resolved for this to work.
+ */
+ bool maybeFunctionalArgument() {
+ if (argIndex == null) {
+ return false;
+ }
+ AstNode argList = containingNode;
+ if (argList is! ArgumentList) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
* Determine if the offset is contained in a preceding comment token
* and return that token, otherwise return `null`.
*/

Powered by Google App Engine
This is Rietveld 408576698